archives

« Bugzilla Issues Index

#3596 — Function Environment Records: The dual role of [[thisValue]] and its relation with [[thisInitializationState]] render the situation somewhat confusing: suggesting to use [[thisBindingStatus]] and [[thisValue]] instead with redistributed roles


For function environment records, one has to record the following informations regarding its this-binding:

(a) whether the environment record has a local this-value;
(b) if yes, whether the this-value is initialised;
(c) if yes, the value of the this-value.

These informations are stored in two components:

(1) [[thisValue]] stores informations (a) and (c);
(2) [[thisInitializationState]] stores (b).

That situation is mildly confusing, for the HasThisBinding() method of the environment record has to make the distinction between:
* "[[thisValue]] has the value empty" (arrow-function), returning `false`; and:
* "[[thisValue]] has no value" (derived constructor with non-initialised this-binding), returning `true`.

--

I suggest to use the following fields instead.

(1) [[thisBindingStatus]], encodes informations (a) and (b). It has three possible values:
* Absent: there is no local this-binding (arrow-function);
* Uninitilized: there is a local, but uninitialized, this-binding;
* Initialized: the this-binding is initialised and its value is recorded in [[thisValue]].

(2) [[thisValue]] encodes information (c) only. It contains the this-value when it is present and initialised; but it is not explicitly set to empty in case of arrow-functions.


fixed in rev34 editor's draft


fixed in rev34