Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is "Object"?)

Axel Rauschmayer axel at rauschma.de
Sat Sep 29 16:30:28 PDT 2012


> I think it is time to recognize that the built-in ES constructors have always presented  a class-like structure where it really is unnecessary and even arguably undesirable for their associated prototype objects to also act as instance objects.  It's time to abandon that precedent and starting with the new ES6 built-ins to specify prototypes simply as objects that are containers of the methods shared by instances. In general, they should not be usable as instance objects.


+1

If one doesn’t explicitly look at these things, one will never find out about them. It mostly matters for String.prototype.match if the argument is RegExp.prototype and for Array.isArray if the argument Array.prototype. But how often does that happen?

Axel

-- 
Dr. Axel Rauschmayer
axel at rauschma.de

home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120930/97e78489/attachment.html>


More information about the es-discuss mailing list