Boost logo

Boost :

Subject: Re: [boost] [local] Review
From: Hartmut Kaiser (hartmut.kaiser_at_[hidden])
Date: 2011-11-21 10:44:41


> > For everything else, there already exist a couple of solutions
> (Boost.Bind, Boost.Lambda and Boost.Phoenix). I would like to see
> improvements in ease of use in these libraries instead of advertising a
> completely macro based solutions.
>
> In no way are Boost.Bind, Boost.Lamda, and Boost.Phoenix equivalent to
> Boost.Local in functionality in practice. In Boost.Local, you have to
> learn some new (relatively straightforward) syntax for declaring the local
> function, but the function body is plain C++. For the other libraries by
> contrast you have to learn a completely new syntax for writing *all* of
> the code in your function, and if you get something wrong you get
> literally pages of error messages that give you no insight as to what
> happened. The learning curve for Boost.Local is lightyears ahead of the
> competitors.
>
> I personally don't like the verbosity of Boost.Local so I often prefer to
> start by using Boost.Lambda instead for small functions instead, but I
> can't tell you how many times I have eventually decided to give up and
> just use Boost.Local because it was becoming a waste of my time to figure
> out what the obscure error messages were telling me about what went wrong.

Sorry, I still don't get it - so please excuse my ignorance.

What exactly is missing from C++11 lambdas for them to be useful as local
functions?

    void foo()
    {
        auto f = [](){ cout << "Hey, I'm a local function!\n"; }
        f();
    }

Why do we need Boost.Local instead?

Regards Hartmut
---------------
http://boost-spirit.com
http://stellar.cct.lsu.edu


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