What is an Object Type(O)?

Allen Wirfs-Brock Allen.Wirfs-Brock at microsoft.com
Sat Mar 7 10:53:15 PST 2009


Your understand in your last paragraph is correct.

In general, the term "type" used in the specification is referring to the categorization of values defined in Section 8.  One of those "types" is "object". Functions are values of the object type.  The section 5.2 definition of Type(x) is correct but perhaps should be elaborated upon as: Type(x) is shorthand for "the type of x" where possible types are those defined in Section 8 (ie, Undefined, Null, Boolean, String, Number, Object, Reference, List, Completion, Property Descriptor, Property Identifier, Lexical Environment, and Environment Record).

Note that there are very few cases where a value might be either one of the "ECMAScript language types" (the first 6 types in the list above) or one the "specification types" (the rest of them) so most often Type(x) predicates in the specification is just choosing from among the language types.

The actual coding of this test is obviously implementation dependent and I'm not familiar with your specific implementation so I can't say whether or not the functions you showed are correct.

I'll think about whether or not I can easily clarify this in the specification.  I've always found to definition of Type(x) to be obscure and hard to find.

Allen

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


More information about the Es-discuss mailing list