On 5/30/2012 9:26 AM, Eric Niebler wrote:
> On 5/30/2012 4:33 AM, Joel Falcou wrote:
>> Won't having a way to build it properly from the get go be a better
>> solution ?
>> This basically require the feature we spoke about earlier so that
>> building a X * Y
>> node check which from X or Y is a double and put it in the proper place ?
>> Then when doing X * Expr, check if there is a double at child<0> of expr
>> and restructure the whole tree at generation time ?
> That's not a bad suggestion. You can do this today with a custom generator.
Incidentally, I'm now working on an C++11 rewrite of proto. Mathias'
feature request and this problem have only served to reinforce a feeling
I've had for a while that generators are the wrong abstraction. It's
fine for simple expression wrapping, but for anything more complicated,
it simply makes no sense to build an expression only to have the
generator rip it apart and build a different one.
There's already a way to define a per-domain as_expr and as_child. What
is needed is a per-domain make_expr. Rather than building an expression
and passing it to a generator, I'll be passing child expressions and a
tag to a domain and asking it to build an expression from them. This, I
think, is the way it should have been designed from the beginning.
However, it means that you will no longer be able to use a proto grammar
as a generator. That was cute functionality, but I don't think it was
terribly useful in practice. How do folks feel about the loss of that
proto mailing list