Boost logo

Boost :

Subject: Re: [boost] phoenix::bind
From: Giovanni Piero Deretta (gpderetta_at_[hidden])
Date: 2008-10-03 07:09:13


On Fri, Oct 3, 2008 at 2:25 AM, Peter Dimov <pdimov_at_[hidden]> wrote:
>
> Incidentally, you might consider supporting a scopeless let (if it doesn't
> already work):
>
> lambda(_x, _y)[ let( _z = _x + _y ), _z * _z ]
>
> analogous to a C++ local variable:
>
> auto _z = _x + _y;
> return _z * _z;
>

Nice.

> and maybe even dispense with the let at all:
>
> lambda(_x, _y)[ _z = _x + _y, _z * _z ]
>
> although this has the usual drawback with being ambiguous with an assignment
> to an outer-scope _z:
>
> lambda( _x, _y, _z = 0 )[ _z = _x + _y, _z * _z ]
>

No please, I hate this in python. Let 'let' be (no pun intended).

BTW, Joel, if Phoenix can do this easily, major kudos!

-- 
gpd

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