|
Boost : |
Subject: Re: [boost] [local] Review
From: Hartmut Kaiser (hartmut.kaiser_at_[hidden])
Date: 2011-11-21 11:30:28
> On Mon, Nov 21, 2011 at 10:44 AM, Hartmut Kaiser
> <hartmut.kaiser_at_[hidden]> wrote:
> >> > 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?
>
> As it was clarified in a couple of other reviews, if you have C++11
> lambdas, you'd probably use them instead of Boost.Local (the only plus of
> Boost.Local is that you don't need extra variables to bind by const but
> that's a minor advantage).
Yes, IMHO it's not worth creating a full library just for this minor case.
> If instead you need to write local functions
> that will work on both C++03 and C++11, you can use Boost.Local and on
> C++11 the local functions programmed with Boost.Local will have the same
> performance as lambdas.
Ok. However this raises a more serious question. Should we as the Boost
community still encourage solutions and libraries solely for portability
with ancient compilers? I'd say no, but YMMV. Boost will be still around 2,
5, or 10 years from now. What's the utility of adding such a _solely_
backwards oriented library from this POV?
Based on your arguments I'd suggest to make (Non-)Boost.Local available
somewhere for other people to use and for you to maintain in the long term.
You don't have to have it in Boost just for it to be used and useful for
others. What's the point in cluttering Boost with this?
I'm sure, any review manager interested in keeping Boost healthy and alive
would agree with me. Adding each and every library which seems to be cool
just for the sake of it - without thinking about the long term consequences
- hurts Boost. Badly.
But I better shut up on this before I'm going to become wind up too much...
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