Use case for std.bind

Bill Baxter wbaxter at gmail.com
Wed Feb 25 16:51:03 PST 2009


On Thu, Feb 26, 2009 at 9:21 AM, Andrei Alexandrescu
<SeeWebsiteForEmail at erdani.org> wrote:
> Jason House wrote:
>>
>> The first follow-up to your reply captured the kind of messiness bind
>> can bring in C++. So far, all your examples are trivial (lack
>> argument reordering, function composition, etc...). It's true that
>> your examples look clean, but the devil will be in the details.
>
> I see. The only problem is that very few people seem to use std.bind; there
> are few interesting examples of arbitrary partial argument binding that need
> formalization. The one good example I know of is those float vector
> permutations, but nobody in their right mind would use a delegate for that!
>
> That all makes it even more appealing to stick with a five-liner in
> std.functional that gets currying into the bag (which is a useful and
> low-hanging fruit) and call std.bind history. Makes sense?

I think simple is fine here.
About the only places I've used boost::bind in C++ are things that I
would never use a bind library to do in D,  since in D we have nested
functions and delegates.   Those things knock about 80% of the wind
out of a bind library in my opinion.

--bb



More information about the Digitalmars-d mailing list