Skip to content

Commit

Permalink
Editorial: Remove circularity in the definition of function names
Browse files Browse the repository at this point in the history
Always derive CreateBuiltinFunction _name_ and _prefix_ from the defining section,
either by processing an explicit name or by referring to property name and disposition,
and don't assume a value of "name" except as set by that operation.
  • Loading branch information
gibson042 committed Sep 30, 2022
1 parent 44141e3 commit 51a5efd
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -28593,22 +28593,22 @@ <h1>ECMAScript Standard Built-in Objects</h1>
<p>Unless otherwise specified every built-in function and every built-in constructor has the Function prototype object, which is the initial value of the expression `Function.prototype` (<emu-xref href="#sec-properties-of-the-function-prototype-object"></emu-xref>), as the value of its [[Prototype]] internal slot.</p>
<p>Unless otherwise specified every built-in prototype object has the Object prototype object, which is the initial value of the expression `Object.prototype` (<emu-xref href="#sec-properties-of-the-object-prototype-object"></emu-xref>), as the value of its [[Prototype]] internal slot, except the Object prototype object itself.</p>
<p>Built-in function objects that are not identified as constructors do not implement the [[Construct]] internal method unless otherwise specified in the description of a particular function.</p>
<p>Each built-in function defined in this specification is created by calling CreateBuiltinFunction. The values of the _length_ and _name_ parameters are the initial values of the *"length"* and *"name"* properties as discussed below. The values of the _prefix_ parameter are similarly discussed below.</p>
<p>Each built-in function defined in this specification is created by calling CreateBuiltinFunction. The value of the _length_ parameter is the initial value of the *"length"* property as discussed below. The value of the _name_ and _prefix_ parameters are similarly discussed below.</p>
<p>Every built-in function object, including constructors, has a *"length"* property whose value is a non-negative integral Number. Unless otherwise specified, this value is equal to the number of required parameters shown in the subclause heading for the function description. Optional parameters and rest parameters are not included in the parameter count.</p>
<emu-note>
<p>For example, the function object that is the initial value of the *"map"* property of the Array prototype object is described under the subclause heading &laquo;Array.prototype.map (callbackFn [ , thisArg])&raquo; which shows the two named arguments callbackFn and thisArg, the latter being optional; therefore the value of the *"length"* property of that function object is *1*<sub>𝔽</sub>.</p>
</emu-note>
<p>Unless otherwise specified, the *"length"* property of a built-in function object has the attributes { [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *true* }.</p>
<p>Every built-in function object, including constructors, has a *"name"* property whose value is a String. The value may be explicitly specified, as for each built-in function associated with a property whose property key is a Symbol value (for example, <emu-xref href="#sec-function.prototype-@@hasinstance">Function.prototype [ @@hasInstance ]</emu-xref>). Where not explicitly specified, the value is implicitly determined by the section in which the function is defined (i.e., where its behaviour is specified). If that section specifies the function as anonymous, the value of its *"name"* property is the empty String. Otherwise, that section specifies the function as the [[Value]], [[Get]], or [[Set]] attribute of a particular property of either the global object or some other built-in object, and the value of its *"name"* property is the property name of that property.</p>
<emu-note>
<p>Some built-in function objects are defined in one section and referenced in one or more other sections specifying their reuse as the value of another property, and for such functions the value of the *"name"* property is determined by the section defining their behaviour. For example, the value of the *"name"* property of %Object% is *"Object"* despite use of that function object as the value for both `Object` and `Object.prototype.constructor` (<emu-xref href="#sec-object.prototype.constructor"></emu-xref>).</p>
</emu-note>
<p>When calling CreateBuiltinFunction to create a built-in function object, the values passed to the _name_ and _prefix_ parameters are derived from its *"name"* property as defined above and its disposition according to the following rules:</p>
<p>Every built-in function object, including constructors, has a *"name"* property whose value is a String set by CreateBuiltinFunction using the _name_ and _prefix_ parameters. The value of its *"name"* property may be explicitly specified, as for each built-in function associated with a property whose property key is a Symbol value (for example, <emu-xref href="#sec-function.prototype-@@hasinstance">Function.prototype [ @@hasInstance ]</emu-xref>). Where not explicitly specified, the value of a function's *"name"* property is implicitly determined by the section in which the function is defined (i.e., where its behaviour is specified). When calling CreateBuiltinFunction to create a built-in function object, the values passed to the _name_ and _prefix_ parameters are derived from that section according to the following rules:</p>
<ol>
<li>If the value of the *"name"* property is explicitly specified and that value starts with the prefix *"get "* or *"set "* and the function is a get accessor function or set accessor function, the part of that value following the prefix is passed to the _name_ parameter and *"get"* or *"set"* (respectively) is passed to the _prefix_ parameter.</li>
<li>Otherwise, if the value of the *"name"* property is not explicitly specified and function is a get accessor function or set accessor function, the value of the *"name"* property is passed to the _name_ parameter and *"get"* or *"set"* (respectively) is passed to the _prefix_ parameter.</li>
<li>Otherwise, the value of the *"name"* property is passed to the _name_ parameter and the empty String is passed to the _prefix_ parameter.</li>
<li>If the value of the *"name"* property is explicitly specified and that value starts with the space-terminated prefix *"get "* or *"set "* and the function is a get accessor function or set accessor function, the part of that value following the prefix is passed to the _name_ parameter and *"get"* or *"set"* (respectively) is passed to the _prefix_ parameter.</li>
<li>Otherwise, if the value of the *"name"* property is explicitly specified, the value of the *"name"* property is passed to the _name_ parameter and the empty String is passed to the _prefix_ parameter.</li>
<li>Otherwise, if the the function is specified as anonymous, the empty String is passed to the _name_ parameter and the empty String is passed to the _prefix_ parameter.</li>
<li>Otherwise, the section specifies the function as the [[Value]], [[Get]], or [[Set]] attribute of a particular property of either the global object or some other built-in object. The property name of that property is passed to the _name_ parameter. If the function is a get accessor function or set accessor function, *"get"* or *"set"* (respectively) is passed to the _prefix_ parameter; otherwise the empty String is passed to the _prefix_ parameter.</li>
</ol>
<emu-note>
<p>Some built-in function objects are defined in one section and referenced in one or more other sections specifying their reuse as the value of another property, and for such functions the values passed to CreateBuiltinFunction are determined by the section defining their behaviour. For example, the value of the *"name"* property of %Object% is *"Object"* despite use of that function object as the value for both `Object` and `Object.prototype.constructor` (<emu-xref href="#sec-object.prototype.constructor"></emu-xref>).</p>
</emu-note>
<p>Unless otherwise specified, the *"name"* property of a built-in function object has the attributes { [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *true* }.</p>
<p>Every other data property described in clauses <emu-xref href="#sec-global-object"></emu-xref> through <emu-xref href="#sec-reflection"></emu-xref> and in Annex <emu-xref href="#sec-additional-built-in-properties"></emu-xref> has the attributes { [[Writable]]: *true*, [[Enumerable]]: *false*, [[Configurable]]: *true* } unless otherwise specified.</p>
<p>Every accessor property described in clauses <emu-xref href="#sec-global-object"></emu-xref> through <emu-xref href="#sec-reflection"></emu-xref> and in Annex <emu-xref href="#sec-additional-built-in-properties"></emu-xref> has the attributes { [[Enumerable]]: *false*, [[Configurable]]: *true* } unless otherwise specified. If only a get accessor function is described, the set accessor function is the default value, *undefined*. If only a set accessor is described the get accessor is the default value, *undefined*.</p>
Expand Down

0 comments on commit 51a5efd

Please sign in to comment.