Boost logo

Boost :

From: Daniel Walker (daniel.j.walker_at_[hidden])
Date: 2008-06-06 16:31:42


On Fri, Jun 6, 2008 at 2:05 PM, Eric Niebler <eric_at_[hidden]> wrote:
> Daniel Walker wrote:
>> Does Phoenix allow side-effects or is it "pure" functional like Fusion
>> and FC++? Does it allow modification of arguments by reference -
>> either builtin references or reference_wrapper?
>
> Yes. Placeholders are substituted with argument references, so you can
> do this:
>
> int i = 0;
> (++_1)(i);
> assert(1 == i);
>
> Local variables that appear in Phoenix lambdas are captured by value,
> unless you specify that you want them captured by reference. You can do
> that with phoenix::ref().

OK, but I was thinking more of user defined function objects. Something like ...

struct f_ {
    template<class> struct result {
        typedef void type;
    };
    template<class T>
    void operator()(T& t) { ++t; }
};

int main()
{
    phoenix::function<f_> f;
    int i = 0;
    f(i);
    assert(i == 1);
}

Actually, I just tried this and the assertion failed. So, I assume
user defined function objects are required to be "pure." Why is that?

>
>> What is the status of the Phoenix msvc port? The documentation seems
>> to indicate that it's possible but not necessarily forthcoming.
>
> MSVC port? Phoenix works on MSVC and always has, AFAIK.

Well, I just tried a little smoke test with msvc 9, and it appears to
work. However, from the documentation at http://tinyurl.com/6pkmtu:

"On the other hand, although Phoenix is not yet ported to MSVC,
Phoenix uses the same tried and true implementation techniques used by
the Spirit framework. Since Spirit has been ported to MSVC by Bruce
Florman (v1.1) and by Raghav Satish (v1.3), it is very likely that
Phoenix will also be ported to MSVC."

>
>> Is there any immediate plan to make Phoenix interoperable with the
>> coming standard library's std::bind, std::placeholders,
>> std::is_bind_expression, and std::is_placeholder?
>
> I don't know. I do know that Phoenix has been ported to Proto in its
> entirety (by me), and this might be a nice addition for Phoenix v3.

That's cool. If possible I think it would be a good idea.

>
> <snip lots>
>
>> One last thing - I noticed that FC++ was submitted for inclusion in
>> Boost a few years back. What ever happened with that?
>
> It was rejected. I seem to recall people feeling that it wasn't C++-ish
> enough.

>From my initial foray into the documentation I'm getting the same feeling.

Thanks!
Daniel Walker


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