Removes procedures from the Prolog database.
pred_spec or pred_spec_tree
A predicate specification, or a list of such.
Note that the default is to only allow a single predicate
tree/1 option below.
list of term, must be ground
A list of zero or more of the following:
Specifies whether SICStus Prolog is to abolish the predicate
even if it is static (
true), or only if it is dynamic
false). The latter is the default.
Specifies whether the first argument should be a pred_spec_tree
true), or a pred_spec (
false). The latter is the
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/[1,2] removes any properties
that the procedure might have had, such as being dynamic or multifile.
You cannot abolish built-in procedures.
It is important to note that
erase/1 only remove clauses, and only of dynamic
procedures. They don’t remove the procedures themselves or their
properties properties (such as being dynamic or multifile).
abolish/[1,2], on the other hand, remove entire procedures
along with any clauses and properties.
The procedures that are abolished do not become invisible to a currently running procedure.
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:’, procedures 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.
if one of the arguments is not instantiated enough.
Predicates is not a valid tree of predicate specifications, or a Name is not an atom or an Arity not an integer.
if an Arity is specified as an integer outside the range 0-255.
if a specified procedure is built-in, or imported into the source module,
or static when
force(true) is not in effect.
| ?- [user]. % compiling user... | foo(1,2). | ^D % compiled user in module user, 10 msec -80 bytes yes | ?- abolish(foo). ! Type error in argument 1 of abolish/1 ! expected pred_spec, but found foo ! goal: abolish(user:foo) | ?- abolish(foo,[tree(true)]). ! Permission error: cannot abolish static user:foo/2 ! goal: abolish(user:foo,[tree(true)]) | ?- abolish(foo/2). ! Permission error: cannot abolish static user:foo/2 ! goal: abolish(user:foo/2) | ?- abolish(foo/2,[force(true)]). yes % source_info
abolish/1 is part of the ISO Prolog standard;
abolish/2 is not.