Expression closures - use-cases for shortcut lambda syntax (blocks)
Brendan Eich
brendan at mozilla.org
Thu Mar 15 22:58:27 PDT 2007
On Mar 15, 2007, at 7:38 PM, John Cowan wrote:
>> Also, "?" is a perfectly permissable character for an identifier.
>> Wouldn't it cause problems to give it special meaning? (for Greeks
>> especially)
>
> Not really, no more than it causes problems to give "if" special
> meaning.
js> o = {if: 42}
[object Object]
js> o.if
42
js> function if(x){return 1+x}
js> if(42)
/* oops */;
js> function::if(42)
43
The scenario to consider is: existing ES3 content uses the lambda
unichar as a single-character identifier of a function. Then λ(x) +x
looks like a call to the λ function, then an evaluation of a variable
x, then an add operator evaluation. If λ is short for function, then
the example sentence is ambiguous.
/be
More information about the Es4-discuss
mailing list