4 ms·
Just realized that Crockford didn't link to it in his post. Here's the full proposal that Brendan Eich added to the ES Wiki: http://wiki.ecmascript.org/doku.php
by jashkenas 15y ago
Just realized that Crockford didn't link to it in his post. Here's the full proposal that Brendan Eich added to the ES Wiki: http://wiki.ecmascript.org/doku.php?id=strawman:arrow_function_syntax http://wiki.ecmascript.org/doku.php?id=strawman:arrow_functi...
- robocat 15y agoThe part I found interesting was: "However, we don’t want CoffeeScript’s ->, it’s confusing to have two arrows and dynamic this binding is an oft-fired footgun."
- jashkenas 15y agoIt looks like Eich's original pitch was for both => (lexical this) and -> (dynamic this), but the latter was cut for political reasons. Out-of-band info from here: https://twitter.com/brendaneich/status/186156717506166784 https://twitter.com/brendaneich/status/186156717506166784 https://twitter.com/brendaneich/status/186160406300082176 https://twitter.com/brendaneich/status/186160406300082176 https://twitter.com/brendaneich/status/186162306521120770 https://twitter.com/brendaneich/status/186162306521120770 https://twitter.com/brendaneich/status/186162532367601666 https://twitter.com/brendaneich/status/186162532367601666
- robocat 15y agoThanks. Interesting!
- Cushman 15y agoI'd be interested to hear from any regular user of CoffeeScript who finds -> vs. => confusing.
- deleted 15y ago[deleted]
- maxbrunsfeld 15y agoI didn't know what to make of that comment. Dynamic this-binding is used heavily in any OO javascript code; it's not a feature that should be ignored when designing the new syntax. To me, writing 'this' as part of the parameter list for methods is more confusing than having a second arrow operator.
- robocat 15y agoWas: From my understanding of binding, this proposal means that the fat arrow can't be used to define 'methods' on a prototype. Edit: as per parent article, use (this, x) => { this.property = x; } instead of ->
- tomjen3 15y agoThat is usually not my problem -- I need it to bind this when I am making a for or map loop or registering a callback handler.