diff --git a/infra.bs b/infra.bs index 2237cd5..5e1b27b 100644 --- a/infra.bs +++ b/infra.bs @@ -14,8 +14,11 @@ urlPrefix: https://tc39.github.io/ecma262/#; spec: ECMA-262; type: dfn text: %JSON.parse%; url: sec-json.parse text: %JSON.stringify%; url: sec-json.stringify + text: Completion Record; url: sec-completion-record-specification-type text: List; url: sec-list-and-record-specification-type text: The String Type; url: sec-ecmascript-language-types-string-type + text: abrupt completion; url: sec-completion-record-specification-type + text: abstract operation; url: sec-algorithm-conventions-abstract-operations text: realm; url: realm type: method; for: Array; text: sort(); url: sec-array.prototype.sort type: abstract-op; @@ -644,6 +647,46 @@ Standard that should be reported and addressed. +
ECMA-262 defines some algorithms as [=abstract operations=] which may be invoked from algorithms +in other specifications. Some of these [=abstract operations=] return a type of value named +[=Completion Record=] which ECMA262 uses to model control flow interruptions such as thrown +exceptions. Because web specifications do not observe the same conventions (e.g. +exception handling is built in to the processing model), +preserving the operations' semantics necessarily involves handling [=Completion Records=]. +[[!ECMA-262]] + +
This specification defines a shorthand named ? as a +convenience for web specifications wishing to faithfully interpret ECMA-262 [=abstract operations=] +which return [=Completion Records=]. Algorithms which invoke such operations are encouraged to +integrate them concisely and consistently using this shorthand. + +
Algorithm steps that say or are otherwise equivalent to: + +
Let |result| be ? AbstractOperation(). +
mean the same thing as: + +
Let |hygienicTemp| be AbstractOperation(). +
Assert: |hygienicTemp| is a [=Completion Record=]. +
If |hygienicTemp| is an [=abrupt completion=], throw |hygienicTemp|.\[[Value]]. +
Let |result| be |hygienicTemp|.\[[Value]]. +
This shorthand is intended to be suitable for use with any invocation, but the first +of the two preceding examples does not match all common calling conventions. See tc39/ecma262 issue #1573 +for details. + +
Return ? [$Call$](%JSON.parse%, undefined, « |string| »). +
Return ? [$Call$](%JSON.parse%, undefined, « |string| »).
To parse JSON bytes to a JavaScript value, @@ -1744,7 +1787,7 @@ given a JavaScript value |value|:
Let |result| be ? [$Call$](%JSON.stringify%, undefined, « |value| »). +
Let |result| be ? [$Call$](%JSON.stringify%, undefined, « |value| »).
Since no additional arguments are passed to %JSON.stringify%, the resulting string will have no whitespace inserted. @@ -1781,7 +1824,7 @@ standards, it is often more convenient to convert between JSON and realm-indepen given a string |string|:
Let |jsValue| be ? [$Call$](%JSON.parse%, undefined, « |string| »). +
Let |jsValue| be ? [$Call$](%JSON.parse%, undefined, « |string| »).
Return the result of [=converting a JSON-derived JavaScript value to an Infra value=], given |jsValue|.