arrow function syntax simplified
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?
-- removed by next revision:
# 2012/03/29 06:05 show differences to current version
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.
More information about the es-discuss