From: Brian McNamara (lorgon_at_[hidden])
Date: 2004-02-19 13:40:29
On Thu, Feb 19, 2004 at 09:26:40AM -0500, Douglas Gregor wrote:
> On Thursday 19 February 2004 09:09 am, Peter Dimov wrote:
> > boost::function<void(int, int)> f;
> > f(2)(3); // same as f(2, 3)
> > but note what happens when someone inadvertently omits a trailing argument:
> > f(2); // compile-time error now, silent no-op with prefix currying
> > support
> Ah, that'd be a killer. I wasn't thinking about prefix currying.
Indeed. I hadn't thought about this deeply until now. Some aspects of
the design of lambda make implicit (prefix) currying rather incompatible
with it. For example, when you have implicit currying, you expect that
f(x,y)(z) == f(x,y,z)
to hold. But look:
int i, j, k;
_1(i, j, k) // returns i, discards j and k
_1(i, j)(k) // Oops! Not the same!
This is another example of where differences between rather innocuous-
looking design decisions in each of the libraries has large
ramifications in other parts. Boost and FC++ have a different notion of
function arity, and this has an unusual impact on currying.
-- -Brian McNamara (lorgon_at_[hidden])
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk