Anonymous function syntax

Jesse Phillips jessekphillips+d at gmail.com
Wed Sep 21 20:10:06 PDT 2011


On Wed, 21 Sep 2011 18:29:34 -0400, bearophile wrote:

> Walter Bright:
> 
>> D
>>      (a,b) { return a + b; }
> 
> In D to define a true lambda you need types too: auto f = (int a,int b){
> return a + b; };

This is true of C# too and I think is appropriate to mention, though it 
can take the destination type into account when doing inference.

> For D I think I'd like a syntax like: { int a, int b => a + b }
> That in some cases becomes just:
> { a,b => a + b }

I'd rather the C which is basically the same as D already.


More information about the Digitalmars-d mailing list