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

Brendan Eich brendan at mozilla.org
Sat Sep 29 22:21:27 PDT 2012


Allen Wirfs-Brock wrote:
> As I covered in my reply to Brendan, I don't think these are 
> sufficiently defined to really answer.  But if you definition of "an 
> instance" is that Object.prototype.toString.call(Map.prototype) 
> returns "Map" then the latest spec. draft does 1: yes, 2: no

That's precisely at issue, and the two questions are sufficiently 
well-defined: neither over- nor under-specified.

Implementations must be able to make firstborn prototypes uniformly. 
This is what killed ES3's overreaction that tried to make 
RegExp.prototype be an Object instance.

Yes, it's too bad ES3 (and ES1 with Date.prototype) left mutable junk in 
built-in prototypes, but those ships sailed. We can do better without 
requiring Object instances as built-in prototypes, which was Yusuke 
raised for DataView that started this thread.

Does DataView.prototype need any special handling in the ES6 draft?

/be


More information about the es-discuss mailing list