On Wednesday, May 30, 2012 at 12:00 AM, Russell Leggett wrote:
> > > On Tue, May 29, 2012 at 11:52 PM, John Tamplin <[email protected] > (mailto:[email protected])> wrote: > > On Tue, May 29, 2012 at 11:50 PM, Yehuda Katz <[email protected] > > (mailto:[email protected])> wrote: > > > I'm not sure if this makes sense, but something about breaking `call` and > > > `apply` doesn't sit right with me. > > > > Why should an arrow function be treated any differently than an explicitly > > bound function (ie, via bind)? > > > Hah, you beat me too it, I was typing in almost the exact same thing. And not > just bind, either - even the kind of workarounds people would use before bind > like 'var self = this' sorts of things. If someone writes code using the > arrow, what they want is to use the lexically scoped this - they want to use > 'this' just like any other reference captured by the closure. > > Any use of call or apply has to be done carefully and requires knowledge of > how 'this' is used. It effectively becomes another parameter to the function. > In cases of bind or an arrow function, 'this' is removed as a parameter and > is purely another captured reference. There's no special call function to let > you override other closed over values. Why should arrow function's behavior > for 'this' be any different? There is also no reason to think of => as all or nothing, jQuery and it's APIs can still use function expressions where dynamic |this| is expected. If a user tries to pass => to any of these APIs, they will learn quickly that they've done it wrong. - Rick > > - Russ > > > > > > > -- > > John A. Tamplin > > Software Engineer (GWT), Google > > > > _______________________________________________ > > es-discuss mailing list > > [email protected] (mailto:[email protected]) > > https://mail.mozilla.org/listinfo/es-discuss > > > > _______________________________________________ > es-discuss mailing list > [email protected] > https://mail.mozilla.org/listinfo/es-discuss > >
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

