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...@domenic.me> wrote:
> 
> From: es-discuss [mailto:es-discuss-boun...@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.
> 
> Agreed. The pattern shown is really an antipattern in my book (and according 
> to conventional JavaScript wisdom). My understanding is that React encourages 
> this antipattern, but that's not something we should encourage at a language 
> level. (Which is part of why property initializer syntax may not make it, at 
> least not in the form you show).
> _______________________________________________
> es-discuss mailing list
> es-discuss@mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to