Boost logo

Boost :

Subject: Re: [boost] De Bruijn Bind (alternate bind syntax) Interest?
From: Larry Evans (cppljevans_at_[hidden])
Date: 2010-09-04 09:24:26

On 09/03/10 17:12, Larry Evans wrote:
> On 09/03/10 15:46, Dave Abrahams wrote:
>>> Since, as I mentioned, I had trouble understanding how apply
>>> worked, and the code seems pretty complicated, at least to me,
>>> I was hoping DeBruijn's method would offer simplifications.
>> From the examples I've seen so far, this would make it easier for bind
>> library writers at the expense of usability. On th other hand, once
>> lambdas start to use protect() I'm usually giving up on them ;-)
> OK, but at the time I was having trouble, I didn't know of an
> alternative. I'll try to remember the particulars of the problem I
> had to illustrate the point. That also might give Mr. Sankel another
> use case.

The attached illustrates the difficulty I was having with
mpl::apply. Maybe the apply_apply typedef would be a good
use-case for De Bruijn's method. I suspect the problem with
apply_apply is something akin to the variable capture problem
(search for "variable getting captured in:
). That problem is what De Bruijn's method is supposed to solve.

In apply_apply the "variables" are the _1 and _2. Since those are
used both in the op typedef and in the apply_apply typedef and the
apply typedef uses op, I'm guessing that leads to what amounts to the
variable capture.

Of course Mr. Sankel's code doesn't operate on types, only values;
however, I'm guessing it could be transformed to work on types
also, just like much of mpl's code is a translation of value functions
to type functions.


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