The current_class/1
predicate is used to ask whether a class is
currently defined or to get the names of all currently defined
classes.
The class_superclass/2
predicate is used to test whether one class
is a superclass of another, or to find a class's superclasses, or to
find a class's subclasses, or to find all subclass-superclass pairs.
The class_ancestor/2
predicate is used in the same ways for the
ancestor relation between currently defined classes.
As an example, the following goal finds all the ancestors of each currently defined class.
| ?- setof(C-As, (current_class(C), setof(A, class_ancestor(C,A), As)), L).
It binds L
to a list of terms of the form
Class-AncestorList, with one term for each currently defined
class.
Arguably, this predicate violates the principle of information hiding, by letting you ask about how a class is defined. Therefore, you should generally avoid it. It may be useful, however, in debugging and in building programmer support tools.