Re: [PrototypeRoot]

On Sat, 20 Jun 2009, Garrett Smith wrote:
> 
> I still want to know: Why would a program want to know the object's 
> [[Class]]?

It shouldn't, but [[Class]]es are exposed by ECMAScript objects in their 
toString() method and thus if we want to ensure universally consistent 
behaviour we have to define this.


> Even if a program could know the [[Class]], what's to say it won't 
> change in the future?

The specs we write.


> Given a particular object, can that object's [[Class]] property change 
> in the future? If it there is an object that exists, say, some sort of 
> HTMLCollection, and it becomes desirable to make more specific behavior, 
> say "HTMLFormControlsCollection", what would the code that expects the 
> object's class to be HTMLCollection need to do to continue working in 
> multiple versions of multiple browsers?

We would have to test to see if any pages rely on it; if they do, we'd 
have to make sure we don't change the [[Class]] somehow.


> Given all these reasons, it would still seem like a bad idea to program 
> to an object's [[Class]]. Instead, the interface should be programmed to 
> using feature detection.

Yup.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Saturday, 20 June 2009 07:44:16 UTC