next up previous
Next: Procedure parameters Up: Identifier classification Previous: Binding identifier occurrences

Nested environments

Environments can be nested, in which case the binding in the innermost environment hides those in outer environments. This means that a stack can be used to store the Environment values:

Instantiate a stack module for environment values[48]:

$/Adt/Stack.gnrc +instance=Region +referto=Environment :inst
This macro is invoked in definition 57.

New region[49]:
RegionStackPush(CurrentEnv); CurrentEnv = NewScope(CurrentEnv);
This macro is invoked in definitions 21 and 54.

End region[50]:
CurrentEnv = RegionStackTop; RegionStackPop;
This macro is invoked in definitions 21 and 54.



2008-08-30