Skip to content

Commit

Permalink
Editorial: Treat a binding as an 'alias-able' thing
Browse files Browse the repository at this point in the history
... that has a distinct existence from its env rec.
  • Loading branch information
jmdyck committed Aug 25, 2021
1 parent 3a7379c commit c23339c
Showing 1 changed file with 26 additions and 17 deletions.
43 changes: 26 additions & 17 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -9793,7 +9793,8 @@ <h1>
</dl>
<emu-alg>
1. Assert: _envRec_.HasBinding(_N_) is *false*.
1. Create a mutable binding in _envRec_ for _N_ and record that it is uninitialized. If _D_ is *true*, record that the newly created binding may be deleted by a subsequent DeleteBinding call.
1. Let _binding_ be a mutable binding for _N_ and record that it is uninitialized. If _D_ is *true*, record that the newly created binding may be deleted by a subsequent DeleteBinding call.
1. Add _binding_ to _envRec_.
1. Return NormalCompletion(~empty~).
</emu-alg>
</emu-clause>
Expand All @@ -9814,7 +9815,8 @@ <h1>
</dl>
<emu-alg>
1. Assert: _envRec_.HasBinding(_N_) is *false*.
1. Create an immutable binding in _envRec_ for _N_ and record that it is uninitialized. If _S_ is *true*, record that the newly created binding is a strict binding.
1. Let _binding_ be an immutable binding for _N_ and record that it is uninitialized. If _S_ is *true*, record that the newly created binding is a strict binding.
1. Add _binding_ to _envRec_.
1. Return NormalCompletion(~empty~).
</emu-alg>
</emu-clause>
Expand All @@ -9835,9 +9837,10 @@ <h1>
</dl>
<emu-alg>
1. Assert: _envRec_.HasBinding(_N_) is *true*.
1. Assert: the binding for _N_ in _envRec_ is uninitialized.
1. Set the bound value for _N_ in _envRec_ to _V_.
1. <emu-not-ref>Record</emu-not-ref> that the binding for _N_ in _envRec_ has been initialized.
1. Let _binding_ be the binding for _N_ in _envRec_.
1. Assert: _binding_ is uninitialized.
1. Set the bound value of _binding_ to _V_.
1. <emu-not-ref>Record</emu-not-ref> that _binding_ has been initialized.
1. Return NormalCompletion(~empty~).
</emu-alg>
</emu-clause>
Expand All @@ -9863,9 +9866,10 @@ <h1>
1. Perform _envRec_.CreateMutableBinding(_N_, *true*).
1. Perform _envRec_.InitializeBinding(_N_, _V_).
1. Return NormalCompletion(~empty~).
1. If the binding for _N_ in _envRec_ is a strict binding, set _S_ to *true*.
1. If the binding for _N_ in _envRec_ has not yet been initialized, throw a *ReferenceError* exception.
1. Else if the binding for _N_ in _envRec_ is a mutable binding, change its bound value to _V_.
1. Let _binding_ be the binding for _N_ in _envRec_.
1. If _binding_ is a strict binding, set _S_ to *true*.
1. If _binding_ has not yet been initialized, throw a *ReferenceError* exception.
1. Else if _binding_ is a mutable binding, change its bound value to _V_.
1. Else,
1. Assert: This is an attempt to change the value of an immutable binding.
1. If _S_ is *true*, throw a *TypeError* exception.
Expand Down Expand Up @@ -9893,8 +9897,9 @@ <h1>
</dl>
<emu-alg>
1. Assert: _envRec_.HasBinding(_N_) is *true*.
1. If the binding for _N_ in _envRec_ is an uninitialized binding, throw a *ReferenceError* exception.
1. Return the value currently bound to _N_ in _envRec_.
1. Let _binding_ be the binding for _N_ in _envRec_.
1. If _binding_ is an uninitialized binding, throw a *ReferenceError* exception.
1. Return the value currently bound in _binding_.
</emu-alg>
</emu-clause>

Expand All @@ -9913,8 +9918,9 @@ <h1>
</dl>
<emu-alg>
1. Assert: _envRec_.HasBinding(_N_) is *true*.
1. If the binding for _N_ in _envRec_ cannot be deleted, return *false*.
1. Remove the binding for _N_ from _envRec_.
1. Let _binding_ be the binding for _N_ in _envRec_.
1. If _binding_ cannot be deleted, return *false*.
1. Remove _binding_ from _envRec_.
1. Return *true*.
</emu-alg>
</emu-clause>
Expand Down Expand Up @@ -10953,13 +10959,14 @@ <h1>
<emu-alg>
1. Assert: _S_ is *true*.
1. Assert: _envRec_.HasBinding(_N_) is *true*.
1. If the binding for _N_ is an indirect binding, then
1. Let _binding_ be the binding for _N_ in _envRec_.
1. If _binding_ is an indirect binding, then
1. Let _M_ and _N2_ be the indirection values provided when this binding for _N_ was created.
1. Let _targetEnv_ be _M_.[[Environment]].
1. If _targetEnv_ is ~empty~, throw a *ReferenceError* exception.
1. Return ? _targetEnv_.GetBindingValue(_N2_, *true*).
1. If the binding for _N_ in _envRec_ is an uninitialized binding, throw a *ReferenceError* exception.
1. Return the value currently bound to _N_ in _envRec_.
1. If _binding_ is an uninitialized binding, throw a *ReferenceError* exception.
1. Return the value currently bound in _binding_.
</emu-alg>
<emu-note>
<p>_S_ will always be *true* because a |Module| is always strict mode code.</p>
Expand Down Expand Up @@ -11018,7 +11025,8 @@ <h1>
1. Assert: _envRec_.HasBinding(_N_) is *false*.
1. Assert: _M_ is a Module Record.
1. Assert: When _M_.[[Environment]] is instantiated it will have a direct binding for _N2_.
1. Create an immutable indirect binding in _envRec_ for _N_ that references _M_ and _N2_ as its target binding and record that the binding is initialized.
1. Let _binding_ be an immutable indirect binding for _N_ that references _M_ and _N2_ as its target binding and record that the binding is initialized.
1. Add _binding_ to _envRec_.
1. Return NormalCompletion(~empty~).
</emu-alg>
</emu-clause>
Expand Down Expand Up @@ -47001,7 +47009,8 @@ <h1>Changes to BlockDeclarationInstantiation</h1>
</emu-alg>
<p>During BlockDeclarationInstantiation the following steps are performed in place of step <emu-xref href="#step-blockdeclarationinstantiation-initializebinding"></emu-xref>:</p>
<emu-alg replaces-step="step-blockdeclarationinstantiation-initializebinding">
1. If the binding for _fn_ in _env_ is an uninitialized binding, then
1. Let _binding_ be the binding for _fn_ in _env_.
1. If _binding_ is an uninitialized binding, then
1. Perform _env_.InitializeBinding(_fn_, _fo_).
1. Else,
1. Assert: _d_ is a |FunctionDeclaration|.
Expand Down

0 comments on commit c23339c

Please sign in to comment.