abolish/[1,2]

Synopsis

abolish(+PredSpecTree)

abolish(+Name, +Arity)

Removes procedures from the Prolog database.

Arguments


PredSpecTree pred_spec_tree [MOD]
A procedure specification in the form Name/Arity, or a list of such procedure specifications.
Name atom [MOD]
A string representing the name of a predicate.
Arity arity
An integer giving the arity of the predicate.

Description

Removes all procedures specified. After this command is executed the current program functions as if the named procedures had never existed. That is, in addition to removing all the clauses for each specified procedure, abolish removes any properties that the procedure might have had, such as being dynamic or multifile.

You may abolish any of your own procedures, regardless of whether they are dynamic, static, compiled, interpreted, or foreign. You cannot abolish built-in procedures.

It is important to note that retract/1, retractall/1, and erase/1 can only remove dynamic predicates. They cannot remove the predicates properties (such as being dynamic or multifile) from the system. abolish[1,2], on the other hand, can remove both static and dynamic predicates. It removes the clauses of the predicates and its properties.

The procedures that are abolished do not become invisible to a currently running procedure. See ref-mdb-exa for an example illustrating this point.

Space occupied by abolished procedures is reclaimed. The space occupied by the procedures is reclaimed.

Procedures must be defined in the source module before they can be abolished. An attempt to abolish a procedure that is imported into the source module will cause a permission error. Using a module prefix, M:, clauses in any module may be abolished.

Abolishing a foreign procedure destroys only the link between that Prolog procedure and the associated foreign code. The foreign code that was loaded remains in memory. This is necessary because Prolog cannot tell which subsequently-loaded foreign files may have links to the foreign code. The Prolog part of the foreign procedure is destroyed and reclaimed.

Specifying an undefined procedure is not an error.

abolish/2 is an obsolete special case of abolish/1 maintained to provide compatibility with DEC-10 Prolog, C Prolog, and earlier versions of Quintus Prolog.

Exceptions


instantiation_error
if one of the arguments is not ground.
type_error
if a Name is not an atom or an Arity not an integer.
domain_error
if a PredSpec is not a valid procedure specification, or if an Arity is specified as an integer outside the range 0-255.
permission_error
if a specified procedure is built-in or imported into the source module.

See Also

dynamic/1, erase/1, retract/1, retractall/1. ref-mdb-dre