Comments on “Making Built-in Objects Subclassable”
herby at mailbox.sk
Mon Mar 18 04:42:54 PDT 2013
Axel Rauschmayer wrote:
> A few more thoughts:
> complaining, just stating a fact). Putting @@create in constructors C
> makes a lot of sense, but it could, in principle, also be put into
> instance prototypes C.prototype. Then Object.create(proto) could use
> @@create to create the instance whose prototype is proto.
The identifier create is probably used in lots of other places, so this
is non-starter, but if not, it could be simply reused, so that:
newobj = Ctr[@@create]();
newobj.__proto__ = proto;
It is semantically compatible with what Object.create does now.
In fact, if somewhere inside implementation of Object.create one would
use "this[@@create]" to create new instance, and it was moved to
Function.prototype, it could be used as is.
More information about the es-discuss