cfengine/core — pull request #851 by sigurdteigen (2013-08-06 16:09:20+00:00)
Title: Feature/variabletable

This removes the global scope list (VSCOPE) and 'this' Scope stack (CF_STCK). All variables are now stored in various VariableTable structures in EvalContext. VariableTable differs from Scope in that it is primarily accessed using VarRef's (which are parsed struct representations of variable references). A single VariableTable may contain variables from several scopes (bundles).

All global variables are stored in EvalContext::global_variables. Special 'match' variables are stored in EvalContext::match_variables. Variables with limited lifetime (and future bundle-private varibales) are stored in VariableTables tied to stack frames. For example, creating a new Promise stack frame (which is done before a promise is evaluated, creates a new VariableTable to hold the limited lifetime 'this' scope for the promise.

VariableTable is currently backed by RBTree, but this may be suboptimal and could very well be changed in the future. The interface is what's important here.