$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
From: Eric Niebler (eric_at_[hidden])
Date: 2008-06-04 11:42:07
Joel Falcou wrote:
> Eric Niebler a écrit :
>> A very simple example is a lambda library with placeholders. Imagine you 
>> wrote a transform that evaluated lambdas with arguments. When evaluating 
>> a lambda expression such as (_1 + _2) with the arguments (3,4), you 
>> might pass the arguments to the transform as a tuple in the Data 
>> parameter (a.k.a Visitor). Then, when the transform has recursed to a 
>> placeholder terminal, say _1, the result would be the 0th element in the 
>> Data tuple.
> 
> Doesn't this features make context obsolete ?
> I mean instead of using context to traverse the AST and performs 
> evalmuations, oen can simply build a proper visitor and traverse the AST 
> in a way simialr to a classic visitor pattern ?
Yes, in proto v4 contexts are not necessary. They can, in some 
circumstances, be easier to work with then transforms, so I don't plan 
to remove them. They may even be better at compile time.
>> I have reimplemented the Boost Lambda Library on top of proto using this 
>> technique. You can find it here:
> 
> I'll get a look. Seems alos that I missed the v4 branches.
> Is there large changes between this and the last proto zip that was 
> available ont he vault ?
There are non-trivial changes, yes. Most significantly, the protocol for 
implementing custom transforms has changed. Also, a bunch of functions 
and types have been renamed as a result of review feedback.
> Two other questions :
> - why does trasnform apply deep copy onto terminals ?
Not sure what you mean. Can you give an example?
> - I'm currently using proto to implement some parallel programming 
> library and I have to explain what I do with proto to people more used 
> to the classic compilation/semantic vocabulary than to the proto idioms.
> in this context, is it correct to say that transforms are "semantic 
> actions" applied onto the element of the AST ?
Absolutely. A proto transform *IS* a semantic action.
-- Eric Niebler BoostPro Computing http://www.boostpro.com