Boost logo

Boost :

Subject: Re: [boost] Local and Phoenix idiosyncrasy
From: Thomas Heller (thom.heller_at_[hidden])
Date: 2011-11-25 15:02:51


On 11/25/2011 01:56 PM, Mathias Gaunard wrote:
> On 11/25/2011 08:37 PM, Thomas Heller wrote:
>> On 11/25/2011 01:36 PM, Mathias Gaunard wrote:
>
>>> Instead of
>>>
>>> BOOST_PHOENIX_ADAPT_FUNCTION(R, f_, f, N)
>>>
>>> /* ... */
>>> void g()
>>> {
>>> /* ... */
>>> my_higher_order_algorithm( f_(arg2, arg1) + arg3 )
>>> }
>>>
>>> We could just write
>>>
>>> my_higher_order_algorithm( lazy(f)(arg2, arg1) + arg3 )
>>
>> This functionality already exists. It's called bind. What is bind
>> missing?
>
> You cannot write bind(f) like this.
> You must write bind(f, arg1, arg2)

Correct.

> Also there is no complex machinery to involve here. It's just a function
> that constructors a phoenix::function initialized from a PFO and returns
> it.

Ok, so why would I want to do it? What's wrong with binding the PFO?

If you want to lazily call the PFO directly: bind(f, ...);
If you want to capture the PFO for reuse:
let(_f = lambda[bind(f, ...)])[_f, ..., _f]
or:
let(_f = f)[bind(_f, ...), ..., bind(_f, ...)]

So, what do i miss here?


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk