Search code examples
javascriptspecifications

What does it means by "the following additional names" in the ECMA-262 specification?


There is a paragraph:

The “Signature” column of Table 4 and other similar tables describes the invocation pattern for each internal method. The invocation pattern always includes a parenthesized list of descriptive parameter names. If a parameter name is the same as an ECMAScript type name then the name describes the required type of the parameter value. If an internal method explicitly returns a value, its parameter list is followed by the symbol “→” and the type name of the returned value. The type names used in signatures refer to the types defined in clause 6 augmented by the following additional names. “any” means the value may be any ECMAScript language type.

And I want to know exactly what those "the following additional names" are. Does it simply mean all type names in clause 6?


Solution

  • It refers to

    • “any” means the value may be any ECMAScript language type.

    which is a bit weird since it's only one additional name, not necessitating the plural.

    It appears to be a holdover from the paragraph in version 5.1, which listed

    The “Value Type Domain” columns of the following tables define the types of values associated with internal properties. The type names refer to the types defined in Clause 8 augmented by the following additional names.

    • “any” means the value may be any ECMAScript language type.
    • “primitive” means Undefined, Null, Boolean, String, or Number.
    • “SpecOp” means the internal property is an internal method, an implementation provided procedure defined by an abstract operation specification. “SpecOp” is followed by [… a method signature].

    ECMAScript 6 then refactored this by separating the internal methods from the internal properties, removing the need for SpecOp; and removed the [[DefaultValue]]: (Hint) → primitive in favour of the Symbol.toPrimitive mechanism and the [[PrimitiveValue]]: primitive in favour of separate properly typed [[BooleanData]], [[NumberData]] and [[StringData]] slots, removing the need for primitive - leaving only any.