Subject: Re: [boost] De Bruijn Bind (alternate bind syntax) Interest?
From: David Sankel (camior_at_[hidden])
Date: 2010-09-03 21:51:01
On Fri, Sep 3, 2010 at 5:42 PM, Dave Abrahams <dave_at_[hidden]> wrote:
> On Fri, Sep 3, 2010 at 5:22 PM, David Sankel <camior_at_[hidden]> wrote:
> > On Fri, Sep 3, 2010 at 4:46 PM, Dave Abrahams <dave_at_[hidden]> wrote:
> >> On Fri, Sep 3, 2010 at 2:52 PM, Larry Evans <cppljevans_at_[hidden]>
> >> 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 ;-)
> > Usability is hurt from whose perspective? The bind author or the bind
> The bind user
> > And how so?
> 1. It means learning a totally new paradigm for writing ordinary
> lambdas thatso farseems to require the grasp of quite a few concepts
> that are not familiar to the average C++ programmer.
I agree that, so far, I haven't presented a very easy path to understanding
De Bruijn notation. I do think, on the other hand it can be completely
explained succinctly in simple English. Some brain time on this is probably
> bind and its
> cousins may not be as flexible, but they're designed to be intuitively
> graspable (to a C++ programmer), and the paradigm is now going into
> the standard so will be lingua franca.
I'd say the authors have failed in making bind intuitively graspable. Users
may certainly feel like they know what it does, but in reality they don't
understand the needlessly complex semantics. These surface once someone does
something even remotely complicated.
I'm quite confidant that once a user begins to approach counter-intuitive
things like protect and apply they'll try a non-lambda approach that would
be much more clearly expressed in lambda world.
> 2. Again, please correct me if I'm wrong about this, but it looks like
> for "ordinary lambdas" (those that don't need protect), the
> corresponding bind expressions are always shorter and simpler.
"ordinary lambdas" being those that don't need protect, don't need apply,
aren't being passed to other functions, and aren't using other functions?
The only reason you consider these uses ordinary is because anything out of
"ordinary" is too complex to think about with bind semantics. De Bruijn bind
(DBB) can make a new, much more compelling, ordinary.
But to answer your question. I do think that DBB can be easily made to be as
succinct as "ordinary" bind, but this might make learning DBB (and
unlearning bind limitations), more difficult for new users.
-- David Sankel Sankel Software www.sankelsoftware.com 585 617 4748 (Office)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk