Skip to content

Scope Rules

IsaacShelton edited this page Mar 21, 2022 · 1 revision

Scope Rules

There are four main types of scopes:

Scope Termination

Scopes end when:

  • They are closed (either by } or by implicit end of single statement block)
  • They cease to exist anymore (e.g. when the program exits)
  • Terminating statements cause control flow to exit the scope

Examples of terminating statements that can cause control flow to exit the scope:

Going out of Scope

When a scope ends, two things will take place:

  • All unhandled defered statements will be unwound in reverse order
  • All calls to __defer__ will be made
Clone this wiki locally