Boost logo

Boost :

From: joel de guzman (isis-tech_at_[hidden])
Date: 2001-06-01 11:28:14


From: "Vladimir Prus":

> I think that it is possible to write a metaprogram that will take a
general
> expression tree and reparse it assuming whatever precedece you like.
> This is not easily done, though. I actually think that we need some
> metalanguage, most likely functional, which will be mapped to template
> metaprograms. But this is not easily done as well.
>

I spent an hour thinking about this if it is indeed possible. I'd say now
that
it isn't. Here's the reason:

an expression:

   a, (b | c).... explicit grouping

which explicitly groups (b | c) cannot be distinguished, using any meta-
programming techniques, from:

   a, b | c.... implicit grouping (precedence groups (b | c) automatically)

The problem is that we cannot overload the parentheses () for
grouping. There's no way to know whether the user typed the
first or the second expression.

Cheers,
Joel de Guzman


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