To gain access to the public predicates of a module-file, load it as you
would any other file--using
appropriate. For example, if your code contains a directive such as
this directive will load the appropriate file File whether or not File is a module-file. The only difference is that if File is a module-file any private predicates that it defines will not be visible to your program.
The load predicates are adequate for use at Prolog's top level, or
when the file being loaded is a utility such as a library file. When
you are writing modules of your own;
use_module/[1,2,3] is the
The following predicates are used to load modules:
)if all files in F are module-files
Before a module-file is loaded, the associated module is reinitialized: any predicates previously imported into that module are forgotten by the module.
If a module of the same name with a different PublicPredList or different meta-predicate list has previously been loaded from a different module-file, a warning is printed and you are given the option of abandoning the load. Only one of these two modules can exist in the system at one time.
Normally, a module-file can be reloaded after editing with no need to reload any other modules. However, when a module-file is reloaded after its PublicPredList or its meta-predicate declaration (see ref-mod-met) has been changed, any modules that import predicates from it may have become inconsistent. This is because a module is associated with a predicate at compile time, rather than run time. Thus, other modules may refer to predicates in a module-file that are no longer public or whose module name expansion requirements have changed. In the case of module-importation (where all, rather than specific, public predicates of a module are imported), it is possible that some predicates in the importing module should now refer to a newly-public predicate but do not. Whenever the possibility of such inconsistency arises, you will be warned at the end of the load that certain modules need to be reloaded. This warning will be repeated at the end of each subsequent load until those modules have been reloaded.
Modules may be saved to a QOF file by calling