Module Name Expansion

The concept of a source module is explained in ref-mod-som. For any goal, the applicable source module is determined when the goal is compiled rather than when it is executed.

A procedure that needs to refer to the source module has arguments designated for module name expansion. These arguments are expanded at compile time by the transformation

     X -> M:X
     

where M is the name of the source module. For example, the goal call(X) is expanded into call(M:X) and the goal clause(Head, Body) is expanded into clause(M:Head, Body).

Module name expansion is avoided if the argument to be expanded is already a :/2 term. In this case it is unnecessary since the module to be used has already been supplied by the programmer.

The built-in predicates that use module name expansion, and the arguments requiring module name expansion are shown below. These arguments are labeled [MOD] in the Arguments field of the reference page for each.

In all of these predicates, M: can stand for multiple modules. It is the innermost module that is used in this case. For example, call(m1:m2:m3:p) calls m3:p/0.