Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2002-10-03 08:07:05


From: "Vesa Karvonen" <vesa_karvonen_at_[hidden]>

> From: "David Abrahams":
> >How sophisticated is the pattern-matching for function arguments?
>
> It is rather simple. It can currently match any expression composed of
> symbols and pair<>s (list<>s are composed of pair<>s). The match is done
by
> recursively inspecting the pattern looking for a symbol (during
> compilation).

That's sophisticated enough. I guess as long as there's no overloading, a
fast compiler can handle this ;-)

> The language is modelled after ML so that all "native" functions take a
> single parameter and return a single value. Pattern matching is used for
> supporting multiple parameters and multiple return values.
>
> The current prototype interpreter also defines the following expressions
> (which I forgot to introduce in the previous e-mail (well, they were not
> used in any of the examples)):
>
> expr : let< pattern-expr, value-expr, body-expr >
> | q< C++-TYPE >
>
> `let<>' is useful for factoring out computations. It binds the value of
> value-expr to the symbols in pattern-expr and then evaluates body-expr in
an
> environment augmented with the pattern.

This reminds me strongly of Spirit subrules. Were you inspired by Joel's
work on Spirit?

> `q<>' is like `(quote expr)' in Lisp, and is currently used for
introducing
> "foreign" data to the code, but it might be possible to get rid of it, by
> making it so that expressions can be identified and only expressions are
> compiled and evaluated.
>

I think the only really "un-cool" thing about your language is the number
of tweaky abbrevs. It for me it cuts the readability a lot to truncate
5-letter words by two letters.

-----------------------------------------------------------
           David Abrahams * Boost Consulting
dave_at_[hidden] * http://www.boost-consulting.com


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk