stack-unlike behaviour of the execution context stack

# a.d.bergi at web.de (10 years ago)

Hello! In people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts, a paragraph reads:

| Transition of the running execution context status among execution | contexts usually occurs in stack-like last-in/first-out manner. | However, some ECMAScript features require non-LIFO transitions of the | running execution context.

I wonder what this means? My first guess was that this refers to generators, whose contexts enter and leave the stack multiple times at will (in contrast to a normal context that enters only once and is destroyed after being suspended), but I found that generator contexts are pushed to and popped from the stack as everything else.

On closer inspection, I found that the spec sometimes uses the term "remove" and sometimes "pop" when suspending an execution context, but I can't imagine a case where this did not refer to the topmost context on the stack. Can you give me an example? Did I miss something?

Thanks, Bergi

# Allen Wirfs-Brock (10 years ago)

On Apr 20, 2015, at 8:55 AM, a.d.bergi at web.de wrote:

Hello! In people.mozilla.org/~jorendorff/es6-draft.html#sec-execution-contexts, a paragraph reads:

| Transition of the running execution context status among execution | contexts usually occurs in stack-like last-in/first-out manner. | However, some ECMAScript features require non-LIFO transitions of the | running execution context.

I wonder what this means? My first guess was that this refers to generators, whose contexts enter and leave the stack multiple times at will (in contrast to a normal context that enters only once and is destroyed after being suspended), but I found that generator contexts are pushed to and popped from the stack as everything else.

Yes, generators was what I had in mind when I wrote that.

On closer inspection, I found that the spec sometimes uses the term "remove" and sometimes "pop" when suspending an execution context, but I can't imagine a case where this did not refer to the topmost context on the stack. Can you give me an example? Did I miss something?

probably not.

feel free to file a ES7 bug saying that such inconsistent terminology usage should be eliminated.

# Bergi (10 years ago)

Allen Wirfs-Brock schrieb:

feel free to file a ES7 bug saying that such inconsistent terminology usage should be eliminated.

[X] Done: ecmascript#4328

Bergi