PublicShow sourceprolog_autoload.pl -- Autoload all dependencies

The autoloader is there to smoothen program development. It liberates the programmer from finding the library that defines some particular predicate and including the proper use_module/1,2 directive in the sources. This is even better at the toplevel, where just using maplist/3 is way more comfortable than first having to load library(apply). In addition, it reduces the startup time of applications by only loading the necessary bits.

Of course, there is also a price. One is that it becomes less obvious from where some predicate is loaded and thus whether you have the right definition. The second issue is that it is harder to create a stand-alone executable because this executable, without access to the development system, can no longer rely on autoloading. Finally, program analysis becomes harder because the program may be incomplete.

This library provides autoload/0 and autoload/1 to autoload all predicates that are referenced by the program. Now, this is not possible in Prolog because the language allows for constructing arbitrary goals and runtime and calling them (e.g., read(X), call(X)).

The classical version relied on the predicate_property undefined. The current version relies on code analysis of the bodies of all clauses and all initialization goals.

Source autoload is det
Source autoload(+Options) is det
Force all necessary autoloading to be done now. Options:
verbose(+Boolean)
If true, report on the files loaded.
undefined(+Action)
Action defines what happens if the analysis finds a definitely undefined predicate. One of ignore or error.
Source autoload is det
Source autoload(+Options) is det
Force all necessary autoloading to be done now. Options:
verbose(+Boolean)
If true, report on the files loaded.
undefined(+Action)
Action defines what happens if the analysis finds a definitely undefined predicate. One of ignore or error.