
On Tue, Nov 22, 2011 at 9:21 PM, Joel de Guzman <joel@boost-consulting.com> wrote:
Local cannot be an approximation of lambda. As mentioned again and again,
I said this many times before but I feel I should have repeated myself here in my previous reply. Yes you are correct, Locals are not an approximation of lambdas because they cannot be defined within expressions (which is a fundamental defining feature of lambdas). Locals instead define closures at local statement scope, they use statement syntax to implement the function body, they work on both C++03 and C++11, they have compile and run-time performances similar to the ones of C++11 lambdas on C++11 compilers (wow, that's a long sentence but I think it summarizes everything :) ).
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 Phoenix:
Try as hard as you can, but you cannot ever come close to the clarity of the syntax presented there. Proponents of locals have cited error-messages generated by the compiler as a justification for Locals. Locals is probably a good workaround. But hear me out...
--Lorenzo