Boost logo

Boost :

From: Eric Niebler (eric_at_[hidden])
Date: 2007-04-04 14:14:10


Larry Evans wrote:
> On 04/04/2007 02:18 AM, Eric Niebler wrote:
>
>> As discussed here recently, Boost.Proto is an expression template (ET)
>> framework for building domain-specific embedded languages (DSEL). The
>> purpose of this preliminary submission is to solicit feedback prior to a
>> full submission (and to buy myself a little time to polish the
>> docs/tests/examples :-).
>>
> Proto uses or_ and and_ for alternatives
> and sequences. It seems that alt_ and seq_ would be closer
> to the spirit names. Any reason why those names were
> preferred over alt_ and seq_?

Because for what they do, or_ and and_ are the right names. :-) You
realize that these do not create expression templates, right? They are
part of proto's meta-grammar facility. If you want to know if an
expression type E matches grammar G1 or G2, you use:

   proto::matches<E, proto::or_<G1, G2> >

That's a compile-time boolean test. Proto::and_ behaves similarly. Like
mpl::or_ and mpl::and_ (and like || and &&) these do short-circuit
evaluation.

HTH,

-- 
Eric Niebler
Boost Consulting
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