Yeah, that's a better way to say what I (poorly) expressed. It's not that EvaluateConstruct needs to again be called (this would cause multiple allocations). Rather, the super call that arose directly from EvaluateConstruct needs to pass its "constructness" onto the SuperConstructor.
On Mon, Jan 7, 2013 at 11:35 AM, Erik Arvidsson <[email protected]>wrote: > On Sun, Jan 6, 2013 at 10:32 PM, Brandon Benvie > <[email protected]> wrote: > > 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 think you are making this sound worse than it is. > > What isn't working is that super in the constructor doesn't do what you > expect. The following should work > > class MyArray extends Array { > constructor(...args) { > // Intentionally not doing the crazy one-arg-is-length-if-uint32 > this.push(...args); > } > } > > class MyDate extends Date { > constructor(..args) { > var temp = new Date(...args); > this.setTime(temp.getTime()); > } > } > > I agree that it will be confusing to most users and that we should try > to make super in a constructor work for these cases. > > -- > erik >
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

