This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 16450 - Class String
Summary: Class String
Status: RESOLVED WONTFIX
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: WebIDL (show other bugs)
Version: unspecified
Hardware: DEC Neutrino
: P2 normal
Target Milestone: ---
Assignee: Cameron McCormack
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-20 15:42 UTC by Marcos Caceres
Modified: 2012-03-27 00:06 UTC (History)
2 users (show)

See Also:


Attachments

Description Marcos Caceres 2012-03-20 15:42:51 UTC
If class string is an internal property of an object, then it should be defined as [[ClassString]] to be consistant with ECMAScript. It's confusing to bounce from conceptual definitions to object property definitions. Also, there is a pattern to expose all internal properties of an object in ECMAScript5. I think it should be the assumption that Class String will also eventually be exposed to script (or should be explicitly defined to be!). 

If anything, for sanity, give the class string contant names:

platform object: "Platform"
interface prototype object: = "Prototype"
exception interface prototype = "Exception"

or some such. This would be consistant with the use of ECMAScript5 Type(x). In the case of WebIDL, it should be referred to as ClassType(x), then in prose: 

 If ClassType(x) is "Platform"...
Comment 1 Cameron McCormack 2012-03-21 22:51:03 UTC
Internal properties are really just conceptual definitions anyway, they're not expected to exist on the property internally necessarily.

I don't believe there is a way to expose arbitrary internal properties from ES5 objects.

I define the class string solely to avoid redefining [[Class]], to make it possible for pure JS implementations to have Object.prototype.toString behave appropriately.  I think at some point ECMAScript is going to gain an internal property like this, but I don't think they have done so yet.  When they do, we can rewrite Web IDL to use that rather having the "class string" definition.

I don't think it makes sense to have all platform objects return "[object Platform]".
Comment 2 Cameron McCormack 2012-03-27 00:06:28 UTC
I think it is fine how it is, and we definitely don't want to use strings like "Platform".