Allen's lambda syntax proposal
Brendan Eich
brendan at mozilla.com
Thu Dec 4 19:24:47 PST 2008
On Dec 4, 2008, at 7:09 PM, Michael Day wrote:
> Hi Brendan,
>
>> Please read
>> http://wiki.ecmascript.org/doku.php?id=strawman:lambdas
>
> There is a lot of discussion over whether it is necessary to
> introduce syntax sugar instead of a "lambda" keyword, but is there
> any remaining controversy over the semantics of lambdas in
> JavaScript, or is that considered settled at this point?
I've created a bikeshedding monster, I admit. It was not entirely
misdirection on my part :-P.
The main contention about lambdas ignoring syntax is whether the
completion-value creates a hazard that needs to be treated somehow, or
even judged as fatal to the proposal.
> (To throw some more kerosene on the syntax fire, I would point out
> that "fun" for function nicely resembles "var" for variable:
>
> var x = fun y z => y + z;
>
> but it's not big deal :)
Not bad but you lost the necessary (destructuring, default parameters)
parenthesized formal list.
I toyed with 'fun' instead of 'function' in 1995 but it would have
been a misfit in the Java-esque/C-like keyword set, even with 'var'
included.
It's not bad, even now, but it may be that something shorter, or at
least spelled different from any word derived from function (fun, fn)
-- precisely because lambdas as proposed are not like functions in
many ways: arguments, this, return, completion-value.
/be
More information about the Es-discuss
mailing list