Refactorings which involve names have a number of things in common. Names are bound to values in definitions, and then uses of names will be associated with bindings as a part of the static analysis of the compiler. This is called the binding structure of a program.
For instance, in the example
f (x+1) y = 3 + f x + g y where g y = f y + 3 where f z = z+1the green occurrence of
f
is a recursive reference to the
top-level f
whereas the red occurrence refers to the local
definition of f
in the nested where
clause.The refactorings in this category share the condition that the binding structure of the program should be unchanged after the refactoring (except for that explicitly required by the particular refactoring). In particular, it is usually crucial that no name capture takes place during refactoring. For the refactored program to compile successfully, it is also crucial that no name clash/ambiguity/conflicting exports should be introduced during refactoring.