|
Boost : |
Subject: Re: [boost] painless currying
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2011-08-26 18:26:45
AMDG
On 08/26/2011 02:51 PM, Larry Evans wrote:
> On 08/26/11 15:24, Dave Abrahams wrote:
>>
>> No, sorry, but that's just silly. Array indexing is entirely
>> consistent:
>>
>> f[0] => returns int(&)[1][1]
>> f[0][0] => returns int(&)[1]
>> f[0][0][0] => returns int&
>>
> Then so is (using haskell notation):
>
> f :: X -> Y -> Z -> int
>
> f x => returns Y -> Z -> int
> f x y => returns Z -> int
> f x y z => returns int
>
> which is Eric's point. IOW, when supplied with enough arguments,
> the function returns the result_type of the function, just as,
> when a multi-dimensional array is supplied enough arguments
> (or indices) it returns the value type of the array.
>
That's just how functions that take multiple
arguments work in Haskell. It isn't how
C++ works. Trying to create the same behavior
in a language that supports multi-argument
functions directly seems like it would cause
more confusion than good.
In Christ,
Steven Watanabe
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk