From: Douglas Gregor (gregod_at_[hidden])
Date: 2001-05-31 10:59:26


On Thursday 31 May 2001 11:45 am, you wrote:
> --- In boost_at_y..., "joel de guzman" <isis-tech_at_m...> wrote:
> > From: "Douglas Gregor"
>
> ...skipping
>
> > > Doug
> >
> > If we did it George Heintzelman's way, |= instead of = for new
>
> productions,
>
> > we don't have to pay for the feature if we don't use it. The penalty
>
> is the
>
> > added code to the = operator. If we let that as is (no redefines)
>
> and
>
> > use the |= for new productions (alternatives), then we have a
>
> win-win
>
> > situation: no penalty if the feature is not used and clarity in the
> > imperative
> > perspective.
> >
> > a = b;
> > a |= c;
> > a |= d;
> > if (flag) a |= e;
>
> Someone seeing |= might think >>= is also defined. Should
> this also be provided? Then what about &=?

>>= and &= don't make sense in the context of a (E)BNF grammar. For instance:

Rule<> A = B >> C
                 | B >> D;
A &= F;

This would be equivalent to:

Rule<> A = B >> C >> F
                | B >> D >> F;

With |=, it merely adds another alternative production, instead of modifying
each of the productions that already exist.

        Doug