Subject: Re: [boost] New libraries implementing C++11 features in C++03
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2011-11-23 05:03:39
On 11/23/2011 03:21 AM, Joel de Guzman wrote:
> Local cannot be an approximation of lambda. As mentioned again and again,
> a good approximation of lambda is already existing in Boost. Namely: bind,
> lambda and phoenix. I posted a Spirit example of lambda in action using
DSELs for lambdas have a lot of limitations (cannot use functions and
member functions as-is, they must be adapted), compile-time overhead,
runtime overhead (all those small functions do inhibit certain
optimizations that would happen more easily with short straightforward
code, instead it relies on premature aggressive inlining) and have
non-obvious interactions with the rest of the code that make them hard
to use for people without advanced C++ expertise, and deal to error
messages that simply overwhelming and often *cannot* be understood by
Now however, they're very cool, but it's just not the best solution to
the problem. It's one solution, with its own set of advantages (short
concise syntax, polymorphism, compile-time AST that can be manipulated
and transformed) and drawbacks (see above).
Boost.Local is another solution for C++03, which is however made
obsolete by C++11 lambdas.
Both deserve to exist, just like there is both boost::for_each and
BOOST_FOREACH (the latter being obsoleted by the C++11 range for-loop)
even if it's a bit late for Boost.Local to shine.