Read access to [[Class]]?

Brendan Eich brendan at mozilla.org
Sat Jan 28 18:21:28 PST 2012


John-David Dalton wrote:
>> Also note that "[[Class]]" doesn't actually exist as string valued per object state in many implementations. That is one of the problems with the current spec, it creates the impression that it such state actually exists.
>
> Sounds like a per implementation issue/detail. I'm sure there are lots
> of internal corners cut in every implementation.

No, we do not want normative spec language requiring a per-object 
private-named property that determines the 
Object.prototype.toString.call(x).slice(8,-1) result.

Doing this naively will both impose unacceptable overhead *and* allow 
type-confusion attacks.

I sympathize with your goal of avoiding two cases, native and host, one 
of which enumerates cases, the other underspecified -- with the 
private-name override applying only to the non-enumerated cases. We 
should try to unify machinery where we can. Not at the price of 
per-instance "class-name".

/be


More information about the es-discuss mailing list