new instantiation design alternatives
brendan at mozilla.org
Sun Sep 14 21:10:04 PDT 2014
Domenic Denicola wrote:
> I want to give a+1 to Allen. The syntax really is what-you-see-is-what-you-get, which is a great virtue. The C++-derived initializer is cute and tempting, but not nearly as powerful or easy to grok.
"Cute" doesn't enter into it. The reason for a special form is to remove
the bogus degrees of freedom you did not defend above. WYSIWYG is an
orange to the sour apple at stake here, which you then immediately
> That said, I feel weakly that requiring the correct `this = new super(...)`and/or `this = Object.create(new^.prototype)` invocation is a high price to pay for every derived class ever.
Verbosity is bad, but that's a superficial measure. Consider bug
habitat, which compounds in some polynomial or exponential way with all
the extra mandatory tokens.
WYSIWYG can be abused to defend lots of mandatory boilerplate, even
lambda-coding everything. But we're adding `class` precisely to make the
prototypal pattern both more convenient and less bug-prone when
open-coded via functions. If this requires concise special forms, so be it.
More information about the es-discuss