
Eric Niebler a écrit :
In the proto/v4 branch, "Visitor" has been renamed "Data" to more accurately reflect its role as a blob of user-specified data to be passed along to each transform. OK so my first intuition was right then ;)
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 ?
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 ? Two other questions : - why does trasnform apply deep copy onto terminals ? - 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 ?