Andreas Rossberg wrote:
On 5 June 2012 00:56, Anton Kovalyov<[email protected]> wrote:
On Monday, June 4, 2012 at 3:10 PM, Yehuda Katz wrote:
It's too late for jQuery to fix the order now. However, in the face of
arrows or bound functions, we probably could detect a user intent to use
`this` for their own purposes and use that as a signal to change the order.
If I read the code correctly, it means that the same method will have
different signatures depending on the function form: $("*").each(function
(i, item) { … }); vs. $("*").each((item, i) => { … })
If so, I think it will be _very_ confusing.
+1. If anything, I view this example as an argument in favour of _not_
providing isBound.
I see that argument. I wrote recently that isBound should be considered,
and we're doing that. Perhaps Mark's use-case justifies adding it, but
that is kind of an expert feature.
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".
/be
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss