Clarification regarding Completion Records
list at felix-kling.de
Fri Sep 23 14:24:55 UTC 2016
I read these paragraphs over and over again ;) Maybe I just need someone
to explain it to me in different words.
So to apply these to my case:
- `ResolveBinding` is an *"abstract operation"* so it returns a
completion record, whose value is a *"Reference"*, even though
completion records are only supposed to have language values as value
(6.2.2) (this still confuses me)
- As per your quote, `Return ?ResolveBinding(...)` simply returns that
- In `Let exprRef be the result of evaluating Expression`, `exprRef` is
a Reference, the completion record obtained by *"evaluating Expression"*
was implicitly unwrapped, according to 220.127.116.11: *"Any reference to a
Completion Record value that is in a context that does not explicitly
require a complete Completion Record value is equivalent to an explicit
reference to the `[[Value]] field of the Completion Record value unless
the Completion Record is an abrupt completion."`
Am I right so far?
Then, does the sentence
> The algorithms of this specification often implicitly return Completion
> Records whose `[[Type]]` is `normal`.
1. Algorithms may or may not return a completion record (i.e. some do
and some don't).
2. Algorithms *always* return a completion record, but it's not always
*explicitly* stated in the algorithm.
On 2016-09-23 03:32, Bergi wrote:
> Felix Kling wrote:
>> I need some clarification around completion records.
> You'll want to have a look at the algorithmic conventions
> and the implicit coercion of completion values
> | Calls to abstract operations return Completion Records.
> | 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:
> | > Return "Infinity".
> | means the same thing as:
> | > Return NormalCompletion("Infinity").
> | However, if the value expression of a “return” statement is a
> | Completion Record construction literal, the resulting Completion
> | Record is returned. If the value expression is a call to an abstract
> | operation, the “return” statement simply returns the Completion
> | Record produced by the abstract operation.
> Yes, it's a bit sloppy, but makes the spec much more readable. It's
> already technical enough, so this does formally apply some common
> sense :-)
> kind regards,
> es-discuss mailing list
> es-discuss at mozilla.org
More information about the es-discuss