Home Contents Index Summary Previous Next

A.2 library( check ): Elementary completeness checks

This library defines the predicate check/0 and a few friends that allow for a quick-and-dirty cross-referencing.

check
Performs the three checking passes implemented by list_undefined/0, list_autoload/0 and list_redefined/0. Please check the definition of these predicates for details.

The typical usage of this predicate is right after loading your program to get a quick overview on the completeness and possible conflicts in your program.

list_undefined
Scans the database for predicates that have no definition. A predicate is considered defined if it has clauses, is declared using dynamic/1 or multifile/1. As a program is compiled calls are translated to predicates. If the called predicate is not yet defined it is created as a predicate without definition. The same happens with runtime generated calls. This predicate lists all such undefined predicates that are referenced and not defined in the library. See also list_autoload/0. Below is an example from a real program and an illustration how to edit the referencing predicate using edit/1.


?- list_undefined.
Warning: The predicates below are not defined. If these are defined
Warning: at runtime using assert/1, use :- dynamic Name/Arity.
Warning: 
Warning: rdf_edit:rdfe_retract/4, which is referenced by
Warning:         1-st clause of rdf_edit:undo/4
Warning: rdf_edit:rdfe_retract/3, which is referenced by
Warning:         1-st clause of rdf_edit:delete_object/1
Warning:         1-st clause of rdf_edit:delete_subject/1
Warning:         1-st clause of rdf_edit:delete_predicate/1

?- edit(rdf_edit:undo/4).

list_autoload
Lists all undefined (see list_undefined/0) predicates that have a definition in the library along with the file from which they will be autoloaded when accessed. See also autoload/0.

list_redefined
Lists predicates that are defined in the global module user as well as in a normal module. I.e. predicates for which the local definition overrules the global default definition.