Each predicate of the program is assigned a module, called it's definition module. The definition module of a predicate is always the module in which the predicate was originally defined. Each active goal in the Prolog system has a context module assigned to it.
The context module is used to find predicates from a Prolog term. By
default, this module is the definition module of the predicate running
the goal. For meta-predicates however, this is the context module of the
goal that invoked them. We call this module_transparent in
SWI-Prolog. In the `using maplist' example above, the predicate
maplist/3
is declared module_transparent. This implies the context module remains extend
,
the context module of add_extension/3. This way maplist/3
can decide to call extend_atom in module
extend
rather than in it's own definition module.
All built-in predicates that refer to predicates via a Prolog term are declared module_transparent. Below is the code defining maplist.