Node:Importation, Next:, Previous:Def Modules, Up:Module Intro


When a module-file is loaded by load_files/[1,2] or one of its shorthands (see Read In), by default all the public predicates of the module-file are imported by the receiving module. An explicit list of predicates to import may also be specified.

Name clashes with already existing predicates, local or imported from other modules, are handled in two different ways: If the receiving module is the user module, the user is asked for redefinition of the predicate. For other receiving modules, a warning is issued and the importation is canceled. In the first case redefinition silently takes place if the redefine_warnings Prolog flag has the value off. The binding of an imported predicate remains, even if the origin is reloaded or deleted. However, abolish/[1,2] break up the importation binding. When a module-file is reloaded, a check is made that the predicates imported by other modules are still in the public list. If that is not the case, a warning is issued. Note that an imported predicate may be re-exported.