Scope Constructs

Stratego -- Strategies for Program Transformation
Stratego provides scope constructs for several types of data.

The term variable scope? {x1,...,xn:s} delimits the scope of bindings to the term variables xi to the strategy s. That is, at the start of the scope fresh, unbound variables are allocated, and after the scope ends, the variables are removed and any old variables with the same name are restored. The binding of term variables by a match does not have to coincide with the scope.

The dynamic rule scope? {|L:s|} delimits the scope of dynamic rules with label L to the strategy s. Any rule generated during the execution of s is removed after the scope ends, and any old rules are restored.

The anonymous file scope? xtc-temp-files(s) is used in XTC to manage the intermediate files that are used to store the terms exchanged by transformation tools. It mainly keeps track of which anonymous files are generated, and makes sure these are removed when exiting the scope.

Can the notion of scope be generalized and made into a first-class construct in the language?

-- EelcoVisser - 14 Jun 2003