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

Vassily Gavrilyak gavrilyak at gmail.com
Sat Mar 17 14:22:27 PDT 2007


> The API in question supports either one argument or two, actually. We
> ended up supporting both because of syntax economy.
.........
>but people prefer to use MochiKit.Base.method(obj, methodName)
because they don't
> have to type as much.
That's exactly what we are discussing here, just a syntax sugar for
less typing and reading.
In this particular case - (obj,method) - people will use it even in
typed language (ES4).
I saw also people providing sortBy(nameOfProperty) method, untyped,
just to save keystrokes in C# and write
people.SortBy("name", "desc");
instead of right way
people.Sort(delegate(Person a, Person b){ return a.name > b.name ;})
The same method is present in ActionScript actually.
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.


Vassily


> -bob
>



More information about the Es4-discuss mailing list