Allowing super to use EvaluateConstruct, or "How do I inherit from Date?"

Brandon Benvie brandon at brandonbenvie.com
Sun Jan 6 19:32:17 PST 2013


Despite separating out @@create into a property of functions, which allows
allocation and setting of BuiltinBrand for subclasses, this still leaves
inheriting from most builtins just short of possible because they are
"construct sensitive". The new ES6 classes like Map, Set, WeakMap, and
typed arrays have been carefully designed so the constructor initializes
`this`. But this still leaves most of the existing builtins
un-subclassable. I know there's a strawman that addresses this, and many of
the recent changes to the ES6 spec have been moving toward making this
possible, but I don't recall seeing commentary on a planned solution for
this.

It seems like the last hurdle to actually making this work is simply making
it possible for `super` to just "forward" to EvaluateCall or
EvaluateConstruct depending on which of them invoked the function that the
super call was in. Is this solution possible for ES6? Or maybe there's
another plan in the works to address this? Or is this something that can be
looked for in harmony (which I presume now refers to es-after 6/es7)?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130106/f589291f/attachment-0001.html>


More information about the es-discuss mailing list