On Wed, May 30, 2012 at 1:32 PM, Allen Wirfs-Brock <[email protected]>wrote:

>
> On May 29, 2012, at 10:05 PM, Rick Waldron wrote:
>
>
> 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]> wrote:
>
> On Tue, May 29, 2012 at 11:50 PM, Yehuda Katz <[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.
>
>
> However, there might be some utility (at least for debugging) in having a
> Function.prototype.isThisBound method.  It would return true for arrow
> functions and functions created via Function.prototype.bind
>

This was actually expressed by the JSFixed group - that a means of
detecting bound functions would essentially mitigate any perceived pain
points of fat-arrow-functions. If we can get consensus on something like
this, it would allay community concerns about the fat arrow.

I would make one minor suggestion, and that is to shorten it to "isBound"

Rick



>
> Allen
>
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to