On Dec 4, 2012, at 10:57 AM, Erik Arvidsson wrote: > > On Tue, Dec 4, 2012 at 12:42 PM, Allen Wirfs-Brock <[email protected]> > wrote: > > > If you forget to do the super[create] call you don't get [[Prototype]] > initialized. However, if you leave out that super call you will also not > allocate any superclass provided per instance state. So, it would be buggy > anyway. > > I was really hoping this would solve the Array subclass problem. Is this how > you imagined it working then? > > Array.@@create = function() { > var newObj = []; > newObj.__proto__ = this.prototype; > return newObj; > }; >
This indeed should solve the array subclassing problem. You code is logically what Array.@@create needs to do. In the spec. it will be expressed as a call to an abstraction operation that creates an exotic array object. That call is parameterized with the [[Prototype]] value for the new instance. Allen
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

