Why are ES6 class methods not automatically bound to the instance?
Mark S. Miller
erights at google.com
Wed Feb 10 16:28:08 UTC 2016
Hi Jordan, this is an excellent point. I can't say I remember it being
raised, but it would certainly have been adequate to kill any proposal that
this be the default behavior.
On Wed, Feb 10, 2016 at 8:22 AM, Jordan Harband <ljharb at gmail.com> wrote:
> One of the wonderful features of many prototype methods is that they can
> be borrowed and .call-ed on other objects (imagine if you couldn't
> `Array.prototype.slice.call(arguments)`!). Auto binding would cripple this
> feature, and it seems like opting out would be harder than opting in.
>
> I'm not sure if that was part of the reasoning or not, but I believe it
> was definitely the right decision.
>
>
> On Wednesday, February 10, 2016, Sam Gluck <sdgluck at gmail.com> wrote:
>
>> Hi all,
>>
>> Hope this is the right place for a purely out-of-interest query - if not,
>> apologies, please ignore!
>>
>> Why are methods on an ES6 class not automatically bound to their
>> instance? Is there any public documentation/conversation, or reasoning,
>> that can explain this decision? (I couldn't find any on esdiscuss.org.)
>>
>> Thank you.
>>
>> Best
>> Sam
>>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
--
Cheers,
--MarkM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20160210/516764cc/attachment-0001.html>
More information about the es-discuss
mailing list