On Sep 17, 2014, at 6:40, "Kevin Smith" <zenpars...@gmail.com<mailto:zenpars...@gmail.com>> wrote:
constructor(x, y) { if (new^) this = new super(x); else super.constructor(x); this.y = y; } The point here is that the purpose of the constructor method is not only allocation, but also (and primarily) initialisation. Yes - you are right. And I think we can safely assume that users will refuse to write such boilerplate. That seems fine. Enabling different behaviour for called vs. constructed should only be used to explain the builtins; user code should not do so themselves. So it makes sense to me that those trying to do that would get "punished" with having to type more. The more pressing ergonomic question is whether `this = new super(...)` is too much. I think it's fine, especially in comparison to `Base.call(this, ...)`. (For those counting characters, the score comes down to how long your superclass name is, and I'd wager most are longer than the five characters required for the new syntax to start winning.) I'll have to consider things for a bit before replying to the larger point. _______________________________________________ es-discuss mailing list es-discuss@mozilla.org<mailto: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