Expression closures - use-cases for shortcut lambda syntax (blocks)

Vassily Gavrilyak gavrilyak at gmail.com
Sat Mar 17 15:22:32 PDT 2007


On 3/18/07, Igor Bukanov <igor at mir2.org> wrote:
> On 17/03/07, Vassily Gavrilyak <gavrilyak at gmail.com> wrote:
> ...
> > Now this is easy to fix and C# 3 fixed, providing inference and
> > anonymouse functions shortcuts
> >
> > Now people can write shortly and typed
> > people.OrderBy( it => it.name)
> > ES4 is almost as good, but still longer
> > people.orderBy(function(it) it.name)
> > So people would still use shorter untyped version.
>
> So why not to propose C# syntax? IMO
>  array.filter(elem => elem > 0)
> looks better than
>  array.filter((\elem) elem > 0)
>
> Regards, Igor
>


---------- Forwarded message ----------
From: Vassily Gavrilyak <gavrilyak at gmail.com>
Date: Mar 18, 2007 12:20 AM
Subject: Re: Expression closures - use-cases for shortcut lambda syntax (blocks)
To: Igor Bukanov <igor at mir2.org>


I already proposed it.

>>File.open("file", (file))=>{
>>   //process
>>});
>>May be C# way will be good, and C# is ECMA too. It has the same
superfluous () as ES3, >>but looks good.

More examples from C# spec
x => x + 1                                                      //
Implicitly typed, expression body
x => { return x + 1; }                  // Implicitly typed, statement body
(int x) => x + 1                                        // Explicitly
typed, expression body
(int x) => { return x + 1; }    // Explicitly typed, statement body
(x, y) => x * y                                 // Multiple parameters
() => Console.WriteLine()               // No parameters


Regards,
Vassily



More information about the Es4-discuss mailing list