- Reference manual
- Why Use Modules?
- Defining a Module
- Importing Predicates into a Module
- Defining a meta-predicate
- Overruling Module Boundaries
- Interacting with modules from the top level
- Composing modules from other modules
- Operators and modules
- Dynamic importing using import modules
- Reserved Modules and using the `user' module
- An alternative import/export interface
- Dynamic Modules
- Transparent predicates: definition and context module
- Module properties
- Compatibility of the Module System
- Reference manual
The following predicates can be used to query the module system for reflexive programming:
- True if Module is a currently defined module. This predicate enumerates all modules, whether loaded from a file or created dynamically. Note that modules cannot be destroyed in the current version of SWI-Prolog.
- module_property(?Module, ?Property)
- True if Property is a property of Module. Defined
- True when Class is the class of the module. Defined classes
- Default for user-defined modules.
systemand modules from
- Other modules from the system directories.
- Module is temporary.
- Modules that create tests.
- Modules that only support the development environment.
- True if Module was loaded from File.
- True if Module was loaded from the N-th line of file.
- True if Module exports the given predicates. Predicate indicators are in canonical form (i.e., always using name/arity and never the DCG form name//arity). Future versions may also use the DCG form and include public operators. See also predicate_property/2.
- True if Module exports the given operators. Each exported
operator is represented as a term
- Memory (in bytes) used for storing the predicates of this module. This figure includes the predicate header and clauses. Future versions might give a more precise number, including e.g., the clause index tables.
- If present, this number limits the
program_size. See set_module/1.
- Integer expression the last database generation where a clause was added or removed from a predicate that is implemented in this module. See also predicate_property/2.
- Modify properties of the module. Currently, the following properties may
- Set the default import module of the current module to Module.
Typically, Module is one of
system. See section 6.9.
- Set the class of the module. See module_property/2.
- Maximum amount of memory used to store the predicates defined inside the
module. Raises a permission error if the current usage is above the
requested limit. Setting the limit to 0 (zero) removes the limit. An
attempt to assert clauses that causes the limit to be exceeded causes a
resource_error(program_space)exception. See assertz/1 and module_property/2.