Scoping Units

next up previous contents index
Next: External Names Up: ScopesDeclarations, and Previous: Scoped Identifiers

Scoping Units

The scope of variable declarations and equates is defined in terms of scoping units. This section contains a complete list of the scoping units of Theta.

  1. From the start of a routine or type specification (9) to its end.

  2. From the start of a module (10.1), routine implementation (10.2), or class (10.4) to its end.

  3. From a for (8.8), do (8.8,8.7), begin (8.13), or the then in a make statement (8.17) to the matching end.

  4. From a then, elseif, or else in an if statement (8.6) to the end of the corresponding body.

  5. From a when or others in a tagcase statement (8.11), typecase statement (8.12), or except statement (8.14) to the end of the corresponding body.

If one scoping unit overlaps another (textually), then one is fully contained in the other. The contained scope is called a nested scope, and the containing scope is called a surrounding scope.