Function literals and lambda functions

Simen kjaeraas simen.kjaras at gmail.com
Sun Mar 6 08:45:13 PST 2011


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.

-- 
Simen


More information about the Digitalmars-d mailing list