Boost logo

Boost :

From: Jaakko Jarvi (jajarvi_at_[hidden])
Date: 2002-03-08 10:51:47


> * Bind supports up to nine arguments and is easily extended to N. The
> current implementation of Lambda has only three placeholders defined.
Added a note about this (I do not change the docs in the CVS though).

> * 8.2.1: I consider this a minor incompatibility with a simple workaround. I
> can't change Bind to match Lambda because Bind has much simpler type
> deduction and cannot infer the return type when the function object is a
> nested bind.
What is your opinion about the semantics?

> * 8.2.2: This is a more serious issue. FWIW, experience with Boost.Bind
> shows that the stricter arity checking in this particular case doesn't
> increase safety significantly; the most common arity errors are (1) arity
> mismatch between the function object and the number of bind() arguments, and
> (2) accessing an element (with _N) that doesn't exist.

The rationale behind the choise made in BLL was, that I'd think
many would find code like this

int foo(int);
foo(1, 2);

not failing at compile time, but rather calling foo(1), unsafe.

> I consider Bind's ability to ignore input arguments (regardless of their
> placement) important, since it directly supports one of its uses: a
> "signature adaptor." Often, you have a boost::function<> with a specific
> signature and a concrete function that is almost compatible with it, except
> that it doesn't need the third function<> argument, has the first and the
> second reversed, and needs zero for its third. bind(f, _2, _1, 0) and you're
> done.

I'm not sure I understood this right, but the way to write this in BLL
would be:

_3, bind(f, _2, _1, 0)

Now it's explicit that this is a three argument function, the left hand
argument of comma does nothing, the result is the right hand side of

> In effect what I'm trying to say is: I would very much like to see a Lambda
> that can eat bind_test.cpp.

Yes. There are slight differences between semantics of boost::bind and
lambda::bind, which is a somewhat difficult issue.

> In other news, I've updated Bind in the CVS to use inline functions as
> placeholders.

Do you mean _1(), or the function pointer trick?


Boost list run by bdawes at, gregod at, cpdaniel at, john at