Boost logo

Boost :

Subject: Re: [boost] phoenix::bind
From: Eric Niebler (eric_at_[hidden])
Date: 2008-09-29 18:19:03

Peter Dimov wrote:
> Eric Niebler:
>> Lambda has some quirks that it would be best to leave behind.
> I agree, but I suspect that we don't agree on the specific quirks to be
> left behind.
> The unary & is on the top of my list. &x should never be overloaded,
> IMHO. Yes, we do have addressof. I'd still have gone with addr(_1) instead.

I've been on the fence about this one in Proto. By default, Proto
overloads unary operator&, but with a twist: a unary operator&
expression tree node is implicitly convertible to a pointer to its
child. That means stuff like "arg<1> const *p1 = &_1;" actually work,
but not in the obvious way.

Proto also gives you the ability to turn off any of Proto's operator
overloads within a domain by defining the grammar of that domain.

> The other thorny issue is that lambda expressions aren't Assignable,
> because their operator= creates a new lambda exression instead. This
> might well be unfixable.

We could make lambdas Assignable by defining the ordinary assignment
operator when the rhs has the same type as the lhs. That would rule out
strange lambdas like "_1 = _1" , but I don't see that as a huge loss.

>> I support Joel's approach of deprecating the old lambda interface and
>> migrating folks to phoenix.
> I've always thought that the plan was for Lambda and Phoenix to merge
> one day.

That used to be the plan, long ago before Joel came to fully appreciate
the subtle differences between the two.

> Apart from that, I'm not a Lambda user, so I don't have an opinion. :-)

Even your non-opinions are valuable. :-)

Eric Niebler
BoostPro Computing

Boost list run by bdawes at, gregod at, cpdaniel at, john at