Boost logo

Proto :

Subject: Re: [proto] proto-11 progress report
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2012-06-25 15:21:52


On 24/06/2012 01:10, Eric Niebler wrote:

> As for what is not changing:
>
> Grammars, Transforms and Algorithms
> ===================================
> It would be wonderful if there were a more natural syntax for describing
> proto algorithms rather than with structs, function objects, proto::or_,
> proto::when, and friends. If there is one, I haven't found it yet. On
> the up side, it means that many current proto-based libraries can be
> upgraded with little effort. On the down side, the learning curve will
> still be pretty steep. If anybody has ideas for how to use C++11 to
> simplify pattern matching and the definition of recursive tree
> transformation algorithms, I'm all ears.

There is a function which is very simple and that I found to be very
useful when dealing with expression trees.

unpack(e, f0, f1) which calls
f0(f1(e.child0), f1(e.child1), ..., f1(e.childN))

I can do recursion or not with the right f1, and I can 'unpack' an
expression to an n-ary operation f0.

Here f0 is typically a function that uses its own overloading-based
dispatching mechanism.

> It needs clang trunk to compile.

Why doesn't it work with GCC?


Proto list run by eric at boostpro.com