|
Boost : |
Subject: Re: [boost] [Phoenix] review
From: David Abrahams (dave_at_[hidden])
Date: 2008-10-02 10:32:30
on Wed Oct 01 2008, Joel de Guzman <joel-AT-boost-consulting.com> wrote:
> I think I am convinced. Even with phx functions, the expressions
> expressing the arguments are already "optionally lazy" anyway
> due to C++:
>
> foo(123 + 456) // foo is a phoenix function
>
> The expression (resulting to the argument) is eagerly evaluated.
> Whereas:
>
> foo(_1 + 456)
>
> it is not (eagerly evaluated).
>
> So it's really a case by case basis depending on what C++ can
> evaluate eagerly.
>
> So, it follows that:
>
> foo(123 + 456)
>
> can be evaluated eagerly, not only the arguments, but foo itself.
> While:
>
> foo(_1 + 456)
>
> can remain lazy, as usual.
It may be the right choice anyway, but keep in mind that any such
nonuniformity limits genericity. I think we already have that with
Boost.Bind ("nested binds are special") but this effect is worth
thinking about.
-- Dave Abrahams BoostPro Computing http://www.boostpro.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk