Next: ref-mod-n2m, Previous: ref-mod-bas, Up: ref-mod [Contents][Index]
The normal way to define a module is by creating a module file for it and loading it into the Prolog system. A module file is a Prolog file that begins with a module declaration.
A module declaration has one of the forms:
:- module(+ModuleName, +PublicPredList). :- module(+ModuleName, +PublicPredList, +Options).
Such a declaration must appear as the first term in a file, and declares that file to be a module file. The predicates in the file will become part of the module ModuleName, and the predicates specified in PublicPredList are those that can be imported by other modules; that is, the public predicates of this module.
Options is an optional argument, and should be a list.
The only available option is hidden(Boolean)
, where
Boolean is false
(the default) or true
. In the
latter case, tracing of the predicates of the module is
disabled (although spypoints can be set), and no source
information is generated at compile time.
Instead of creating and loading a module file, it is also possible to define a module dynamically by, for example, asserting clauses into a specified module. A module created in this way has no public predicates; all its predicates are private. This means that they cannot be called from outside that module except by explicitly overriding the modularity rules as described in ref-mod-vis. Dynamic creation of modules is described in more detail in ref-mod-dmo.