Clarification regarding Completion Records

Bergi a.d.bergi at web.de
Fri Sep 23 07:32:59 UTC 2016


Felix Kling wrote:

> I need some clarification around completion records.

You'll want to have a look at the algorithmic conventions 
(http://www.ecma-international.org/ecma-262/7.0/#sec-algorithm-conventions) 
and the implicit coercion of completion values 
(http://www.ecma-international.org/ecma-262/7.0/#sec-implicit-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,
  Bergi


More information about the es-discuss mailing list