Read access to [[Class]]?

Dmitry Soshnikov dmitry.soshnikov at gmail.com
Sat Jan 28 09:03:01 PST 2012


On Jan 28, 2012, at 8:21 AM, Allen Wirfs-Brock wrote:

> 
> On Jan 27, 2012, at 10:15 PM, John-David Dalton wrote:
> 
>> I noticed in the ES6 draft it states that host objects *do not* have
>> the [[NativeBrand]] internal property.
>> I think "do not have" should be reworded to "are not required to have".
>> This would allow existing inferences like
>> `{}.toString.call(window.opera) == '[object Opera]'`.
>> 
> 
> I probably need to be more explicit about host objects and add another step just before step 5
> 
> If O is a host object, let tag be an implementation defined string value. The value may not be "Array", "Boolean", "Date", "Error", "Function", "JSON", "Math", "Number", "Object", "RegExp", and "String".
> 
> Also, the definition of Host Object needs to be tighten up to make it clear that an object is only a host object if it has some "magical" behavior. 
> 

Yes, it's an old subtle terminological topic which is required to be mentioned in the spec, I think it would be good.

In fact, if an object is completely conforming with the spec, it cannot be distinguished from native objects -- regardless in which language it's written (in JS itself or in a lower language).

Moreover, many "host" objects are implemented in JS itself -- e.g. some standard libraries as in Node.js. I called them inefficiently as "native-host" objects.

But from this viewpoint -- is this algorithm step is correct? I.e. window.opera being as a native-host can nevertheless have as its [[NativeBrand]] values of "Array", "Object", etc?

And a host object then becomes as "an object provided by a host environment and has semantic differentiations from this specification".

(the only thing it's needed to consider is not to make it even more confused or complicated).

Dmitry

> Finally, window.opera is really just a normal object it could use my proposed private name based mechanism to set its toString tag.
> 
> Allen
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120128/0d2bb3f0/attachment-0001.html>


More information about the es-discuss mailing list