[[Class]] Property of Host Object
Allen Wirfs-Brock
Allen.Wirfs-Brock at microsoft.com
Mon Jul 19 14:35:43 PDT 2010
> -----Original Message-----
> From: Mark S. Miller [mailto:erights at google.com]
> Sent: Monday, July 19, 2010 2:02 PM
> >
>> Do we?? What do you think "host object" means?
>
> Objects that are not native objects. I.e., the categories are disjoint and Garrett's
> isHostObject method is correct.
>
Ok, I think we generally agree. "host object" as used in the ES5 spec. in essentially all cases means "not native object". Garrett's isHostObject test would arguably almost be valid if used within a perfectly conforming and unextended ES5 implementation. However, a conforming implementation is allowed to "provide additional types, values, objects,..." and such extensions might include the use of new [[Class]] values. For example, the JSON object is semantically a perfectly normal native object but has a distinct [[Class]] value. If an implementation included a different but similar extension isHostObject would classify it as a "host object". Whether or not you are happy with that result probably depends upon your isHostObject use case.
The starting point of this discussion seems to be the desire to find a reliable way to discriminate "host objects". ES5 wasn't intentionally trying to provide such a mechanism and I don't believe that it accidently did so.
Allen
More information about the es-discuss
mailing list