arrow function syntax simplified
Brendan Eich
brendan at mozilla.org
Sun Apr 1 07:52:18 PDT 2012
Dmitry Soshnikov wrote:
> Oh, wait, just have read Crock's article on => functions. A Python's style of passing manual `this'? That's interesting (why it's not specified on the wiki?
See
http://wiki.ecmascript.org/doku.php?id=strawman:arrow_function_syntax&rev=1332877190
-- removed by next revision:
# 2012/03/29 06:05 show differences to current version
<http://wiki.ecmascript.org/doku.php?id=strawman:arrow_function_syntax&rev=1333001151&do=diff>
strawman:arrow_function_syntax
<http://wiki.ecmascript.org/doku.php?id=strawman:arrow_function_syntax&rev=1333001151>
Updates per TC39 meeting today brendan
The optional leading |this| parameter without an Initialiser (parameter
default value) was long-hand for dynamic-this binding, the "thin arrow"
(->) of previous versions. We agreed with Waldemar on cutting down a
list of five "iffy" design decisions, see his meeting notes. Thin-arrow
and leading |this| fell quickly, and the desire for "one arrow" was clear.
The detailed rationale for killing leading |this| is less clear, but
without it we have fewer function forms as you note (not sure where your
6 count came from, but no worries). The "YAGNI" and "dynamic-this is a
foot-gun" arguments favored leaving out -> or (this, arg1, ~~~ argN)
syntax. These are not absolute judgments, obviously. They're KISS and
"when in doubt, leave it out" relative judgments.
/be
More information about the es-discuss
mailing list