5.14 Module properties
The following predicates can be used to query the module system for reflexive programming:
- [nondet]current_module(?Module)
- 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
properties are:
- class(-Class)
- True when Class is the class of the module. Defined classes
are
- user
- Default for user-defined modules.
- system
- Module
systemand modules from<home>/boot. - library
- Other modules from the system directories.
- test
- Modules that create tests.
- development
- Modules that only support the development environment.
- file(?File)
- True if Module was loaded from File.
- line_count(-Line)
- True if Module was loaded from the N-th line of file.
- exports(-ListOfPredicateIndicators)
- 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.
- exported_operators(-ListOfOperators)
- True if Module exports the given operators. Each exported
operator is represented as a term
op(Pri,Assoc,Name).
- set_module(:Property)
- Modify properties of the module. Currently, the following properties may
be modified:
- base(+Base)
- Set the default import module of the current module to Module.
Typically, Module is one of
userorsystem. See section 5.9. - class(+Class)
- Set the class of the module. See module_property/2.
Tags are associated to your profile if you are logged in
to add a comment