Skip to content

ContextStack

Christian Schladetsch edited this page Mar 21, 2023 · 2 revisions

Context Stack

A history of where execution has come from.

One can:

  • Suspend. This pushes the current context onto the ContextStack and then resumes what is on top of the DataStack.
  • Replace. This replaces the current Continuation with what is on top of the DataStack.
  • Resume. This replaces the current Continuation with what is on top of the ContextStack.

Note that 'Suspend' is like a normal "subroutine call". The other two operations (Replace and Resume) cannot be performed in modern languages that are all almost entirely based on the Subroutine model.

One example is 'Generators' which can be implemented in some languages.

Name Lookup

Name lookup starts at the current Continuation, then traverses back through the scopes of the Context stack, and finally attempts to resolve a name using the context of a Tree.

Clone this wiki locally