|Did you know ...||Search Documentation:|
:- use_module(library(prolog_autoload)).(can be autoloaded)
This predicate is used by qsave_program/[1,2] to ensure the saved state does not depend on availability of the libraries. The predicate autoload_all/0 examines all clauses of the loaded program (obtained with clause/2) and analyzes the body for referenced goals. Such an analysis cannot be complete in Prolog, which allows for the creation of arbitrary terms at runtime and the use of them as a goal. The current analysis is limited to the following:
The analysis of meta-predicate arguments is limited to cases where the argument appears literally in the clause or is assigned using =/2 before the meta-call. That is, the following fragment is processed correctly:
..., Goal = prove(Theory), forall(current_theory(Theory), Goal)),
But, the calls to prove_simple/1 and prove_complex/1 in the example below are not discovered by the analysis and therefore the modules that define these predicates must be loaded explicitly using use_module/[1,2].
..., member(Goal, [ prove_simple(Theory), prove_complex(Theory) ]), forall(current_theory(Theory), Goal)),
It is good practice to use gxref/0 to make sure that the program has sufficient declarations such that the analysis tools can verify that all required predicates can be resolved and that all code is called. See meta_predicate/1, dynamic/1, public/1 and prolog:called_by/2.