Instance bound class methods
sebastian at calyptus.eu
Fri Jul 17 23:13:36 UTC 2015
Domenic, would you care to propose an alternative that is concise and memory efficient if it is an anti-pattern?
That would be helpful and constructive (your comment, not so much).
> On Jul 13, 2015, at 8:27 AM, Domenic Denicola <d at domenic.me> wrote:
> From: es-discuss [mailto:es-discuss-bounces at mozilla.org] On Behalf Of Brendan Eich
>> You're counting on the property assignment being moved into the constructor, where `this` is bound. In a class body in ES6 (without property assignment extension), especially in the top level where method defintiions go, `this` isn't obviously bound to the newly constructed instance.
>> Ok, that's kind of a nit, or an observation. No worries.
> Yeah, just to highlight this, the property initializer syntax is very far from reaching consensus, and I wouldn't take that for granted and then ask if we can build something else on top of it.
>> Bigger question is what we want: method per instance allocation cost, which what you did imposes? Or something that can be more efficiently implemented, such as what Strong/SoundScript proposes (last I looked).
>> The latter is what Java and C++ do. Then the trick is enabling first-class function extraction from method, which is a pay-for-what-you-ask-for alternative to allocation per method per constructed instance.
> es-discuss mailing list
> es-discuss at mozilla.org
More information about the es-discuss