Skip to content

Commit

Permalink
Editorial: Add the abstract closure specification type (tc39#1889)
Browse files Browse the repository at this point in the history
  • Loading branch information
syg authored and ljharb committed Mar 9, 2020
1 parent 4307b77 commit 06faabd
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -3911,7 +3911,7 @@ <h1>Well-Known Intrinsic Objects</h1>

<emu-clause id="sec-ecmascript-specification-types">
<h1>ECMAScript Specification Types</h1>
<p>A specification type corresponds to meta-values that are used within algorithms to describe the semantics of ECMAScript language constructs and ECMAScript language types. The specification types include Reference, List, Completion, Property Descriptor, Lexical Environment, Environment Record, and Data Block. Specification type values are specification artefacts that do not necessarily correspond to any specific entity within an ECMAScript implementation. Specification type values may be used to describe intermediate results of ECMAScript expression evaluation but such values cannot be stored as properties of objects or values of ECMAScript language variables.</p>
<p>A specification type corresponds to meta-values that are used within algorithms to describe the semantics of ECMAScript language constructs and ECMAScript language types. The specification types include Reference, List, Completion, Property Descriptor, Lexical Environment, Environment Record, Abstract Closure, and Data Block. Specification type values are specification artefacts that do not necessarily correspond to any specific entity within an ECMAScript implementation. Specification type values may be used to describe intermediate results of ECMAScript expression evaluation but such values cannot be stored as properties of objects or values of ECMAScript language variables.</p>

<emu-clause id="sec-list-and-record-specification-type">
<h1>The List and Record Specification Types</h1>
Expand Down Expand Up @@ -4393,6 +4393,21 @@ <h1>The Lexical Environment and Environment Record Specification Types</h1>
<p>The Lexical Environment and Environment Record types are used to explain the behaviour of name resolution in nested functions and blocks. These types and the operations upon them are defined in <emu-xref href="#sec-lexical-environments"></emu-xref>.</p>
</emu-clause>

<emu-clause id="sec-abstract-closure">
<h1>The Abstract Closure Specification Type</h1>
<p>The <dfn>abstract closure</dfn> specification type is used to refer to algorithm steps together with a collection of values. Abstract closures are meta-values and are invoked using function application style such as _closure_(_arg1_, _arg2_). Like abstract operations, invocations perform the algorithm steps described by the abstract closure.</p>
<p>In algorithm steps that create an abstract closure, values are captured with the verb "capture" followed by a list of aliases. When an abstract closure is created, it captures the value that is associated with each alias at that time. In steps that specify the algorithm to be performed when an abstract closure is called, each captured value is referred to by the alias that was used to capture the value.</p>
<p>If an abstract closure returns a Completion Record, that Completion Record's [[Type]] must be either ~normal~ or ~throw~.</p>
<p>Abstract closures are created inline as part of other algorithms, shown in the following example.</p>
<emu-alg>
1. Let _addend_ be 41.
1. Let _closure_ be a new abstract closure with parameters (_x_) that captures _addend_ and performs the following steps when called:
1. Return _x_ + _addend_.
1. Let _val_ be _closure_(1).
1. Assert: _val_ is 42.
</emu-alg>
</emu-clause>

<emu-clause id="sec-data-blocks">
<h1>Data Blocks</h1>
<p>The <dfn>Data Block</dfn> specification type is used to describe a distinct and mutable sequence of byte-sized (8 bit) numeric values. A Data Block value is created with a fixed number of bytes that each have the initial value 0.</p>
Expand Down

0 comments on commit 06faabd

Please sign in to comment.