|
Boost : |
Subject: Re: [boost] painless currying
From: Thomas Heller (thom.heller_at_[hidden])
Date: 2011-08-26 15:06:13
On Fri, Aug 26, 2011 at 8:51 PM, Eric Niebler <eric_at_[hidden]> wrote:
> On 8/26/2011 1:46 PM, Thomas Heller wrote:
>> I additionally have some problems in thinking
>> about possible semantics:
>>
>> auto g = f(_, y, z); // pretend that f is a curryable function
>
> If f has a 4th argument, the above returns a binary function and ...
>
>> auto h = g(1); Â Â Â // same as f(1, y, z)? what if f had a 4th argument?
>
> ... that returns a unary function, same as f(1, y, z).
>
>> As much as i like the idea, i can almost always construct trivial
>> usecases where the proposed syntax is ambiguous.
>
> It's not ambiguous, AFAICT.
Right ... ambiguous is the wrong word here ... its just that the
semantics have to be defined, which might not be what you think they
were ...
So how is "painless currying" different than bind?
To me it looks like they both have the same effect of partial function
application.
Bind is more verbose, and is thus easier understandable, at first
sight. While painless currying looks like a very clean and elegant
solution to the same problem it can lead to some undesired effects.
The question now is: Do we really need this?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk