I agree with your conclusion and believe we could call the differentiation that has existed in the spec of "called as a constructor" an anti-pattern, in as far as it's one of those "magical" pieces of state that isn't exposed to user-level code and thus requires even more magic (say in the form of an $$CalledAsConstructor primitive) in order to detect it and self-host the stdlib.
The solution I proposed would serve the goal of making all the builtin classes subclassable, but would also perpetuate the "CalledAsConstructor" anti-pattern down to the subclass level. Your solution is better, and I'm guessing this is what you plan to do with the ES6 spec in the near future, which makes me happy!
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

