Renaming


Identity: Renaming
Category: MultiModule Naming
Classifiers: rename definition
Internal cross references:
External cross references:

Language: General

Description:

Rename a program identifier, which can be a value variable, a type variable, a data constructor, a type constructor, a field name, a class name or a class instance name.


format = ... format ...
entry  = ... format ...
table  = ...
         where
         format = ...
	

fmt    = ... fmt    ...
entry  = ... fmt    ...
table  = ...
         where
         format = ...
	

General comment:

Renames all and only those uses of the identifier associated with a particular definition, and not every use of the particular name.

Note that recursive calls to the function need to be renamed, as well as all calls to the function outside its definition. Also known as α-conversion (alpha-conversion).

In a multi-module system, an unqualified name in a module that imports the new name might become qualified during refactoring to avoid the ambiguity caused by the new name.

Left to right conditions:

The existing binding structure must not be affected.

  • No binding for the new name may exist in the same binding group.
  • No binding for the new name may intervene between the binding of the old name and any of its uses, as the renamed identifier would be captured by the renaming.
  • The binding to be renamed must not intervene between existing bindings and uses of the new name.

The new name should not cause ambiguity in the module containing its definition.

Renaming a top-level identifier should not cause conflicting exports throughout the system.

Right to left conditions:

The refactoring is symmetric, except that some unqualified names might become qualified.

Analysis required:

Static analysis of bindings; call graph; module analysis and name space analysis.