Subject: Re: [boost] phoenix::bind
From: Joel de Guzman (joel_at_[hidden])
Date: 2008-10-01 22:53:06
Giovanni Piero Deretta wrote:
> On Wed, Oct 1, 2008 at 5:32 AM, Joel de Guzman
>> "Primary motivation for including protect into the library,
>> was to allow nested STL algorithm invocations (the section
>> called "Nesting STL algorithm invocations"
> I never got that detail. How is protect better in that case than using
> unlambda? Why would I want to mask a lambda just for one evaluation
> round and not forever?
Because you can't use unlambda there. See my other post.
>> Phoenix had lazy functions since its inception. The general problem
>> was how to implement a higher-order-function that accepts higher-
>> order-function. Like say:
>> phx::for_each(_1, std::cout << _1 << std::endl)
>> substituting the left _1 for the container. The right _1 substitutes
>> the container's element which happens when for_each invokes the
>> input function for each element: f(element).
>> But that can't happen because all _1 will be substituted eagerly.
>> hence, it was necessary to brace the higher-order-function argument:
>> phx::for_each(_1, lambda[std::cout << _1 << std::endl])
> Ok, I do exactly the same with a modified boost.lambda, except that
> the 'lambda' syntax has 'unlambda' semantics, not 'protect'
No it does not. Again, please see my other post. I'll delay my
answer to the rest of this post after we sync our understanding.
As of now, we are not in the same page.
-- Joel de Guzman http://www.boostpro.com http://spirit.sf.net
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk