[ Predicate Database and Compiler | Reference Manual | Alphabetic Index ]

abolish +SpecList

Remove the definition of the predicates specified in SpecList.
SpecList
Sequence of expressions of the form Atom/Integer.

Description

Removes the definition of the predicates specified in SpecList. These predicates must have their definition (clauses) in the context module.

Predicates that are defined elsewhere (i.e. imported or reexported predicates) cannot be abolished. They can only be abolished from their definition module.

After a predicate has been abolished, any attempt to invoke it will give rise to an error 68 (calling an undefined procedure).

Certain declarations about properties of a predicate will remain in effect even after abolishing the predicate. These include declarations that affect the predicate's calling convention (modes, demon, parallel, tool). Moreover, the predicate's visibility (local, exported) is not affected, i.e. if the predicate was exported, it will remain exported.

Predicates can be abolished, no matter whether they are static or dynamic. For dynamic predicates, the difference between retractall/1 and abolish/1 is that retractall/1 leaves the predicates with no clauses (call of the predicate will fail) and the predicate retains its dynamic-property. In contrast, abolish/1 makes the predicates undefined (calls will raise and error) and the predicate loses its dynamic-property.

Error 60 (``referring to an undefined procedure'') is raised when no predicate of name SpecList is visible. Error 100 (``accessing a procedure defined in another module'') is raised if the visible predicate is defined or declared in a different module than the context module.

abolish/1 satisfies the logical update semantics. Abolishing a predicate will not, in any way, affect previous calls to it (when backtracking).

Modes and Determinism

Modules

This predicate is sensitive to its module context (tool predicate, see @/2).

Exceptions

(4) instantiation fault
SpecList is not instantiated
(5) type error
SpecList is instantiated, but not to a sequence of expressions of the form Atom/Integer
(60) referring to an undefined procedure
SpecList is undefined in the context module
(100) accessing a procedure defined in another module
SpecList is not defined in the context module

Examples

[eclipse 1]: [user].
 p :- writeln(hello).
Yes (0.00s cpu)

[eclipse 2]: p.
hello
Yes (0.00s cpu)

[eclipse 3]: abolish p/0.
Yes (0.00s cpu)

[eclipse 4]: p.
calling an undefined procedure p in module eclipse
Abort

[eclipse 5]: abolish writeln/1.
accessing a procedure defined in another module in abolish writeln / 1
Abort

[eclipse 6]: abolish foo/33.
referring to an undefined procedure in abolish foo / 33 in module eclipse
Abort



Logical semantics :

If the following clauses are in the database :
    p(1) :- abolish(p/1).
    p(2).

The call p(X). will produce all the solutions visible when it started
executing :

    [eclipse]: p(X).
    X = 1     More? (;)
    X = 2
    yes.

See Also

retractall / 1