The `super` keyword doesn't work as it should?
Allen Wirfs-Brock
allen at wirfs-brock.com
Mon Jul 25 02:54:14 UTC 2016
> On Jul 24, 2016, at 7:04 PM, /#!/JoePea <joe at trusktr.io> wrote:
>
> What if there was also something like `Function.prototype.bind` like `Function.prototype.with`, so `someFunc.with(homeObject)` returns a new function who's [[HomeObject]] is the specified `homeObject`. It would be possible to do `someFunc.with(...).bind(...)` to configure both the home object and `this`.
>
This was included in the ES6 drafst for quite awhile. Initially with the name defineMethod and latter as toMethod. But it was eventually decided to remove it. The pros and cons of such a function were extensively discussed with in TC39 over a several year period. For example, see https://github.com/tc39/tc39-notes/blob/master/es6/2014-01/jan-28.md#more-on-tomethod <https://github.com/tc39/tc39-notes/blob/master/es6/2014-01/jan-28.md#more-on-tomethod>
The issues with defineMethod/toMethod are summarized in https://github.com/tc39/tc39-notes/blob/master/es6/2015-03/mixin-proposal.pdf <https://github.com/tc39/tc39-notes/blob/master/es6/2015-03/mixin-proposal.pdf> and https://github.com/allenwb/ESideas/blob/master/dcltomethod.md <https://github.com/allenwb/ESideas/blob/master/dcltomethod.md> which is a proposal for an alternative way to address the problem. Notes from that discussion are at https://github.com/tc39/tc39-notes/blob/master/es6/2015-03/mar-25.md#6iv-a-declarative-alternative-to-tomethod-allen-wirfs-brock <https://github.com/tc39/tc39-notes/blob/master/es6/2015-03/mar-25.md#6iv-a-declarative-alternative-to-tomethod-allen-wirfs-brock>
Where it has been left by TC30 is roughly:
1) There are indeed use cases for dynamically configuring the HomeObject binding but they are quite specialized.
2) All of the solution that have been proposed are confusing or error prone.
3) So far, the actual user demand for such a feature is small.
4) We aren’t going to do anything until there is significant real world feedback saying that it really is needed.
Allen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20160724/ab91d491/attachment.html>
More information about the es-discuss
mailing list