arrows and a proposed softCall
John Tamplin
jat at google.com
Tue Jun 5 05:30:48 PDT 2012
On Mon, Jun 4, 2012 at 12:54 PM, Brendan Eich <brendan at mozilla.com> wrote:
> Angus Croll wrote:
>
>> I actually agree. I included non-this methods only because reading
>> through this thread I got a feeling that there was some consensus that
>> they be treated differently. More than happy to not do that.
>>
>
>
> You mean you still propose that (=> 42).call({}) should throw, but
> (function () { return 42; }).call({}) should not?
>
> Sorry, this isn't a principled response. There should be no difference in
> result between those two cases.
>
And the other cases where this is bound should be treated identically:
var self = this;
return function () { self....; }
return function () { this...; }.bind(this);
return => this...;
Aside from the last, these cases already are options that could be passed
to an API that expects to use this as a hidden parameter. Why should the
last be treated differently than the other two?
I don't object to having a non-bound arrow, but aside from jQuery's (IMHO)
misuse of this, the bound-this case seems to be the most prevalent and the
least likely to confuse people.
--
John A. Tamplin
Software Engineer (GWT), Google
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120605/f391c7ee/attachment.html>
More information about the es-discuss
mailing list