On Tue, Jun 5, 2012 at 12:36 PM, Brendan Eich <[email protected]> wrote:
> > What I perceive from the JSFixed effort, and from Angus who is good enough > to post here: people have a particular concern that fat-arrow is too sweet > and it will lure the children into the witch's house: passing fat arrows to > dynamic-this APIs. > > We have data suggesting that fat arrows address the dominant use-case, > thanks to Kevin Smith and others. So fat arrows are in ES6, well and good. > > I think the particular concern about => being an attractive nuisance for > some APIs such as Angus's mixin combinators, which rely on .call overriding > |this|, can be addressed by adding -> too. Angus agrees, but -> is not on > the boards for ES6 (yet). > > We could try to revive ->, but first, we should face the attractive > nuisance argument squarely, instead of dancing around it with isBound > abuses that try to "catch fat arrow going into the witch's house". I think that with ->, a similar problem will still crop up - specifically that => will be the more common use, and then in the rare case that -> is needed, people may still use =>. Do we still need isBound to catch that error as well? Even with the choice of -> or =>, the person writing the code has to know which one to use and why. That means they have to understand the whole dynamic |this| problem. I think that the dynamic |this| behavior of jQuery is not something that should be encouraged. I understand it is probably mostly that way because of the dom event api, but that doesn't change the fact that it really has a bad smell to it. CoffeeScript has ->, but if you look at the examples, none of them actually make use of dynamic |this| except for methods, and we're adding a nice method syntax, so it isn't really needed. Method syntax, and => should cover the majority of cases and lead people down the right path. I know this is going around in a circle, but my point is that adding -> doesn't fix the problem, which is devs not knowing when to use => and when to use function. - Russ > > > /be > > ______________________________**_________________ > es-discuss mailing list > [email protected] > https://mail.mozilla.org/**listinfo/es-discuss<https://mail.mozilla.org/listinfo/es-discuss> >
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

