Read access to [[Class]]?

Allen Wirfs-Brock allen at wirfs-brock.com
Sat Jan 28 16:27:36 PST 2012


On Jan 28, 2012, at 4:07 PM, John-David Dalton wrote:

> @Allen
> 
>> We want to be able to define things that were historically implemented as "host objects" using pure ECMAScript code. One things such objects have done is to extend the range of values produced by Object.prototype.toString.  So, we need a pure ECMAScript way to accomplish that.
> 
> You could simplify it by making `NativeArray = "Array"` and
> `NativeRegExp = "RegExp"` and so on. Then you could drop the "Tags"
> table and extending the range of Object#toString is as easy as adding
> a custom [[NativeBrand]] property value.

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

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

Allen




More information about the es-discuss mailing list