(Weak){Set|Map} subclassing

Erik Arvidsson erik.arvidsson at gmail.com
Tue Dec 4 10:57:52 PST 2012


On Tue, Dec 4, 2012 at 12:42 PM, Allen Wirfs-Brock <allen at wirfs-brock.com>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;
};

-- 
erik
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20121204/328a4256/attachment.html>


More information about the es-discuss mailing list