Read access to [[Class]]?

John-David Dalton john.david.dalton at gmail.com
Sat Jan 28 16:49:29 PST 2012


@Allen

> and name the internal property "[[Class]]".  But then, how would you implement it in pure ES code?

You can name the internal property whatever you want [[Class]] /
[[NativeBrand]] / [[Whatevz]]. It's internal so less important to me
what the name is.

I don't think setting [[NativeBrand]] or having a mechanism for
returning custom Object#toString values should be allowed outside of
the ES implementation internals (ignoring overwriting the method with
a dev defined method).

This is one of the reasons why `{}.toString.call(window.opera)` is
such a strong inference because it's harder to fake w/o mucking with
the Object.prototype.

> 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.

-JDD


More information about the es-discuss mailing list