Boost logo

Boost :

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


On 11/25/2011 01:36 PM, Mathias Gaunard wrote:
> On 11/24/2011 07:14 PM, Thomas Heller wrote:
>> Hi list,
>>
>> Can we please put an end to this insane idiosyncrasy going on here
>> lately? It doesn't lead to anywhere!
>>
>> Ok, we get it ... people want to write local functions in the usual way.
>>
>> Here is what I have to propose: Why not combine Boost.Local and
>> Boost.Phoenix and keep everybody happy?
>> If the macros provided by Boost.Local would emit some instance of a
>> phoenix::function.
>
> The macros provided by Boost.Local already generate PFOs.
> The goal of Phoenix should be to integrate seamlessly with PFOs, which
> are ubiquitous in C++.
>
> It shouldn't be required to make every type be a phoenix type to use it
> with phoenix. That is, currently, the main problem with phoenix: you
> need to adapt all functions before you can use them.
>
> I've already proposed the addition of a function named "lazy" (I think I
> suggested it during both the v2 and v3 reviews), that would be trivial
> to write, and that simply turns a PFO into a phoenix actor.
> That little thing would make Phoenix much more usable.
>
> 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?


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