Subject: Re: [boost] New libraries implementing C++11 features in C++03
From: Joel de Guzman (joel_at_[hidden])
Date: 2011-11-25 23:30:01
On 11/26/2011 12:34 AM, Thomas Klimpel wrote:
> Joel de Guzman wrote:
>> Now, how about error messages. Here's the lambda part:
>> std::for_each(vec.begin(), vec.end(), plus4(_1, b, l, s));
>> You'd have to be absurdly dumb to get that wrong!
> I encountered the following ways to get such a thing wrong (with Boost.Bind) in the
> past: 1) I included both Boost.Lambda and Boost.Bind, and somehow managed that the
> compiler used the Boost.Lambda placeholders instead of the Boost.Bind placeholders.
> This produced a weird error message, if I remember correctly. 2) Make something wrong
> related to the number of arguments (I don't remember exactly details anymore). Got an
> internal compiler error from MSVC8 instead of an error message.
> At least the compiler crash once took me a long time to find out what I did wrong, even
> so it was something really obviously wrong (after I found it).
> I guess it's better now with Boost.Phoenix. However, perhaps interactions between
> std::bind and Boost.Phoenix similar to the interactions between Boost.Bind and
> Boost.Lambda will also generate a similar experience for newer generations of
Indeed. Anyway, as I said in my reply to Steven. I'm sorry about that
insensitive remark. It's an exaggeration.
That said, I would say that it's easier than the bind syntax because
it's just like a function call, except for the placeholders. It is
polymorphic and as Peter Dimov said, requires no casts for plain
overloaded functions as well as template functions. IME, it's a
common complaint with bind not being able to *easily* call overloaded
and template functions.
If I were to write "Effective Phoenix", I'd start with phoenix
functions. They are simple and yet very powerful critters. We've
focused too much on esoteric advanced-pushing-the-limit power
stuff, and as a result, we've alienated those who just want to
just make things work with minimum fuss.
We hear you loud and clear.
-- Joel de Guzman http://www.boostpro.com http://boost-spirit.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk