Subject: Re: [boost] painless currying
From: Larry Evans (cppljevans_at_[hidden])
Date: 2011-09-03 14:44:30
On 09/03/11 11:21, Larry Evans wrote:
> On 09/03/11 11:12, Eric Niebler wrote:
>> On 9/3/2011 10:48 AM, Larry Evans wrote:
>>> when passed arguments that cannot
>>> possibly be valid, the arguments just keep accummulating
>>> in the curryable<F,Args...>::argI.
>>> It would be helpful
>>> if some diagnostic were issued in case too many arguments
>>> are supplied.
>> I agree it would be helpful, but I don't think that's possible. Without
>> true introspection, there is no way to know a priori what the max arity
>> of the bound function is, hence no way to know when we've accumulated
>> more arguments than are valid. It just keeps collecting arguments in a
>> vain attempt to satisfy the can_be_called predicated.
> OK, so *now* I see a good use-case for David Abraham's point:
> about using () to cause evaluation. The user would then know if invalid
> arguments were supplied.
However, if that case (only evaluate if empty arglist provided), there's
really no need to carry the functor, f, along since it's only useful at
the last. Hence, instead of supplying () to trigger evaluation, why not
just supply the f argment last. IOW, instead of:
to trigger evaluation (or a compile-time error messages of the arguments
accummulated by a_curryable are not valid.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk