Function literals and lambda functions

KennyTM~ kennytm at gmail.com
Sun Mar 6 09:04:33 PST 2011


On Mar 7, 11 00:45, Simen kjaeraas wrote:
> Russel Winder <russel at russel.org.uk> wrote:
>
>> So why does:
>>
>> reduce ! ( function double ( double a , double b ) { return a + b ; }
>> ) ( 0.0 , outputData )
>>
>> fail? It implies that a function literal and a lambda are significantly
>> different things as far as the compiler is concerned.
>
> Well, they are. One is a delegate literal, the other a function literal.
> Delegates may be closures, functions may not.
>
> That said, the above looks like it should work, and I'm not sure why it
> doesn't.
>

Probably unaryFun and binaryFun should accept function pointers as well.


More information about the Digitalmars-d mailing list