8.6.2 Object internal properties and methods

2010-04-18 21:31:42

Every object implements a certain set of internal properties and methods. As explained in 8.6.1 these are denoted with double square brackets like [[Prototype]]. They serve to explain the behavior of objects and implementers should act as if they were real properties (without actually exposing them). They may choose to implement them without actually using properties, as long as there are no side effects to the desired behavior.

This means that no implementor is required to actually implement [[Prototype]], but the implementation should behave as if it was under the hood.

If an internal property is used by an algorithm in the specification and the property is not implemented, a TypeError exception is thrown.

There are two sets of internal properties: Those that apply to all objects and those that apply to some objects.

Unless specified otherwise, those methods behave as will ve explained in 8.12 in full. Arrays have a different implementation of the [[DefineOwnProperty]] method. Strings have a different implementation of the [[GetOwnProperty]] method. Arguments have a different implementation for [[Get]], [[GetOwnProperty]], [[DefineOwnProperty]] and [[Delete]]. Functions implement [[Get]] differently.

Host objects can implement these properties any way they wish. But if an implementation does not support some property, a TypeError must be thrown when attempted.