Delete/Add a definition

Identity: Deletion
Category: MultiModule Naming
Classifiers: deletion definition
Internal cross references:
External cross references:

Language: Any language

Description: Delete a definition that is not used.

showAll = ...
format  = ...
table   = ...

showAll = ...
format  = ...

General comment:

This refactoring is mainly used in conjunction with others, such as Unfolding a definition, which will, in general, remove uses of functions that were previously used.

Left to right comment:

Removing an implicitly exported top-level definition from a module need the refactorer to check for use in all modules that import this one.

Right to left comment:

If a definition can be added to the module it is safest not to export the definition, unless the refactorer can ensure that it is not used in any module that imports this one.

This refactoring has not been implemented yet.

Left to right conditions:

The definition should not be used, or explicitly exported, by the module that contains it. If the definition is implicitly exported, it should not be used by any modules that import it. 

There may be other definitions of the same name in wider or narrower scopes; only the definition chosen will be removed.

Right to left conditions:

The converse introduces a new definition which is not used. The definition must be introduced in such a way as not to affect the binding structure of the program, so that

  • There is no definition of the identifier within the same scope.
  • The new binding does not capture any uses of other bindings of the name.

Analysis required:

Static analysis of bindings. In the case of definition removal, to verify that the definition is not used; in the case of definition insertion, to verify that

  • the name is not already defined in the same scope; and
  • the binding structure of the program is unaffected.

Module analysis