W3C home > Mailing lists > Public > public-script-coord@w3.org > October to December 2011

[Bug 14877] Define [[Class]] of interface prototype objects, exception interface objects, and exception interface prototype objects

From: <bugzilla@jessica.w3.org>
Date: Wed, 23 Nov 2011 13:58:49 +0000
To: public-script-coord@w3.org
Message-Id: <E1RTDLd-0007LO-9z@jessica.w3.org>

--- Comment #14 from Aryeh Gregor <ayg@aryeh.name> 2011-11-23 13:58:44 UTC ---
(In reply to comment #12)
> Allen should weigh in here. As noted, [[Class]] is not a supported extension
> mechanism for other specs. We should negotiate a more future-proof way to spec.

It's not?  ES5 says:

The value of the [[Class]] internal property of a host object may be any String
value except one of "Arguments", "Array", "Boolean", "Date", "Error",
"Function", "JSON", "Math", "Number", "Object", "RegExp", and "String".

That suggests to me that specs defining the behavior of host objects are
allowed to give them any [[Class]] they want except for that fixed list.  If
this isn't the intent, the definition of String.prototype.toString has to
change to add a different extension point.

(In reply to comment #13)
> Right, thanks.
> Though what I was getting at was that "The Function prototype object is itself
> a Function object". 

The Function constructor object (Function) is a Function object -- Function
instanceof Function is true.  The Function prototype object
(Function.prototype) is not a Function object, it's a regular Object object --
Function.prototype instanceof Function is false, Function.prototype instanceof
Object is true.  See section 15.3 in ES5: http://es5.github.com/#x15.3

> The third line is a suggestion of what might happen if the suggested change is
> made. As you've pointed out with Function.prototype, that too would not make
> sense.  The idea suggested was what if DOMException.prototype is a DOMException
> object. My mistake was using the instanceof operator here.

It amounts to the same thing.  The DOMException prototype is, as the name says,
only a prototype for DOMException objects, in that all DOMException objects
inherit its properties.  It is not a DOMException itself, and treating it as
one would be inconsistent with how ES5 built-ins work.

Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
Received on Wednesday, 23 November 2011 13:58:54 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:04 UTC