On Thu, Apr 22, 2010 at 9:38 AM, Asen Bozhilov <[email protected]>wrote:
> If I understand correctly specification "8.6 The Object Type" > describe semantic of native objects and does some restriction on host > objects. For example: > > | Every object (including host objects) must implement > | all of the internal properties listed in Table 8. However, > | the [[DefaultValue]] internal method may, for some objects, > | simply throw a TypeError exception. > > That quotation is regard table 8, which contains internal properties > common to all objects. > > My question is regard "8.6.1 Property Attributes", where ECMA-262 > does not restriction on host objects. As I understand these property > attributes are only for native objects and host objects can use > different approaches for property attributes. > > 8.6.1 does not seem to mention anything about host objects., only about named properties. 8.6.2 indeed explicitly says that all objects, native and host, should implement the attributes from table 8. Furthermore, the first paragraph says that any internal property that does not exist should throw a TypeException when accessed anyways. The second paragraph states the _behaviour_ of table 8 is only required for native objects. Host objects may implement them differently, as long as they remain to behave within the limitations of a host object as outlined by the specification. > For example in JScript, Object.prototype.propertyIsEnumerable (V) with > passed host object as the `this` value throw TypeError exception. And > that is described by Microsoft: > <URL: > http://download.microsoft.com/download/8/4/2/8427CF1B-08B3-4557-952D-102E7A8FA64C/%5BMS-ES3%5D.pdf > /> > > | 2.1.62 [ECMA-262] > | Section 15.2.4.7, Object.prototype.propertyIsEnumerable (V) page 63 > | a.If O is a host object, throw a TypeError exception. > > And by ECMA-262 that is conformable behaviour, because specification > does not restrict host objects to implement these property attributes. > > Does someone to make clarification on these things? Thanks. > The attributes must be implemented, and they might all be, but they can all throw a TypeError regardless of what is being done with them. In this case, either the attributes can be seen as getters and setters which always throw TypeErrors, or you can't even get to them because whatever method you use to try that will throw you out before you can reach the actual attribute. Either way, as far as is observable, this behaviour seems in line with the specification. - peter
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

