You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1. If argument is an abrupt completion, return argument.
2. Else if argument is a Completion Record, set argument to argument.[[Value]].
Step 2 assumes that argument may be something different from a Completion Record (either normal or abrupt). The same is with other declarations of ReturnIfAbrupt.
However, Implicit Completion Values guarantees that abstract operations always (with undefined edge cases) return a Completion Record:
Unless it is otherwise obvious from the context, an algorithm statement that returns a value that is not a Completion Record, such as:
Return "Infinity".
means the same thing as:
Return NormalCompletion("Infinity").
that makes the assumption probably excessive.
So I propose:
Either (if non-record values really may be returned) add references to cases covered by "Unless it is otherwise obvious" and replace obviousness with formal criteria;
Or (otherwise):
remove else if foo is a Completion Record, set foo to foo.[[Value]] steps in ReturnIfAbrupt;
rephrase Implicit Completion Values:
The algorithms of this specification often implicitly return Completion Records whose [[Type]] is normal. Unless it is otherwise obvious from the context, an algorithm statement that returns a value that is not a Completion Record, such as:
to:
An algorithm statement that returns a value that is not a Completion Record, such as:
The text was updated successfully, but these errors were encountered:
The handling of completion records is inconsistent in a number of ways; see this label in the issue tracker. For example, the implicit coercion you quote doesn't actually make sense: abstract operations can return values which are neither ECMAScript language values nor ~empty~, but a normal completion can only hold values of those types.
I intend to deal with this more comprehensively when I have time, including eliminating all implicit wrapping and unwrapping.
Thank you, I really missed specification and host types (with examples found in #496). Also, I am happy to hear about planned specification-wide revamping of such incoherencies; I also know that it will require a long time to not break anything and properly update external specifications that refer to ECMAScript abstract operations.
ReturnIfAbrupt describes
ReturnIfAbrupt(argument)
as:Step 2 assumes that
argument
may be something different from a Completion Record (either normal or abrupt). The same is with other declarations ofReturnIfAbrupt
.However, Implicit Completion Values guarantees that abstract operations always (with undefined edge cases) return a Completion Record:
that makes the assumption probably excessive.
So I propose:
Either (if non-record values really may be returned) add references to cases covered by "Unless it is otherwise obvious" and replace obviousness with formal criteria;
Or (otherwise):
remove
else if foo is a Completion Record, set foo to foo.[[Value]]
steps in ReturnIfAbrupt;rephrase Implicit Completion Values:
to:
The text was updated successfully, but these errors were encountered: