Short Functions

Isaac Schlueter i at izs.me
Sat May 21 17:28:35 PDT 2011


I very much want short functions.  However, the semantics of
JavaScript lambdas are so wonderfully simple.

Adding a semantically different callable thing is a huge mistake, in
my opinion.  I'd love to be able to write

    {|a, b, c|  a + b * c }

or even

    (a, b, c) -> { a + b * c }

or

    #(a, b, c) { a + b * c }

instead of

    function (a, b, c) { return a + b * c }

but I really don't want to replace our existing simple semantics.

I see a lot of the discussions of short function syntax seeming to
imply ruby-block semantics, with the "return returns from the parent"
idea.  It would be great to separate those two concerns.  They are
very different.  One is sugar, the other is a much more radical change
to the way the language works, which I'm not altogether convinced is a
good or useful thing.

--i


More information about the es-discuss mailing list