Read access to [[Class]]?
john.david.dalton at gmail.com
Sat Jan 28 19:01:02 PST 2012
> 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'm talking about adding back the wording that ES5.x currently has
allowing host objects to set their own internal [[Class]] (or whatever
it's new incarnation is) value. Most objects will still have an
internal [[NativeBrand]] property of some kind associated with them so
I don't see how this is an overhead concern.
> Not at the price of per-instance "class-name".
The current ES6 draft handles this by allowing objects to *not* have a
[[NativeBrand]] property specified as `Object#toString` will simply
return "[object Object]".
More information about the es-discuss