Subject: Re: [boost] Template metaprogramming libraries
From: Giovanni Piero Deretta (gpderetta_at_[hidden])
Date: 2011-09-16 14:07:27
On Fri, Sep 16, 2011 at 6:09 PM, David Sankel <camior_at_[hidden]> wrote:
> The reason I said that phoenix "somewhat" gets around the bind heritage
> problems, which was obscure I admit, was because phoenix's use of
> traditional bind syntax still leaves a semantic hole.
> If someone writes the following:
> template< typename F >
> auto doSomething( F f ) -> decltype(...)
> Â return bind( f, 15, _1)
> And then I call doSomething elsewhere like this,
> doSomething( bind( g, 12, _1, _2 ) )
> , then the result is something most likely unexpected for the user who knows
> what doSomething means (it returns a version of f that has 15 filled in as
> its first argument (Î»x. Î»y. x(15,y))), but hasn't read its implementation.
Boost.Lambda has unlambda, which is documented to prevent exactly this problem:
With a quick search I couldn't find the phoenix equivalent of
unlambda, but I'm sure there must be.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk