module/2 declaration

Synopsis

:- module(+ModuleName, +PublicPred).

Declares the file in which the declaration appears to be a module-file named ModuleName, with public predicates PublicPred. Must appear as the first term in the file.

Arguments


ModuleName atom
an atom
PublicPred list of simple_pred_spec
List of predicate specifications of the form Name/Arity.

Description

The definition of a module is not limited to a single file, because a module-file may contain commands to load other files. If myfile, a module-file for ModuleName, contains an embedded command to load yourfile and if yourfile is not itself a module-file, then all the predicates in yourfile are loaded into module ModuleName.

If the export list is not properly specified, there will be a warning or error message at compile time.

Exceptions

At compile time:


context_error
Declaration appears other than as the first term in a file being loaded.
instantiation_error
ModuleName not instantiated.
type_error
PredSpecList is not a list of simple_pred_spec

See Also

module/1 ref-mod