5.5 Overruling Module Boundaries

The module system described so far is sufficient to distribute programs over multiple modules. There are however cases in which we would like to be able to overrule this schema and explicitly call a predicate in some module or assert explicitly into some module. Calling in a particular module is useful for debugging from the user's top-level or to access multiple implementations of the same interface that reside in multiple modules. Accessing the same interface from multiple modules cannot be achieved using importing because importing a predicate with the same name and arity from two modules results in a name conflict. Asserting in a different module can be used to create models dynamically in a new module. See section 5.12.

Direct addressing of modules is achieved using a :/2 explicitly in a program and rely on the module qualification mechanism described in section 5.4. Here are a few examples:

?- assert(world:done).  % asserts done/0 into module world
?- world:assert(done).  % the same
?- world:done.          % calls done/0 in module world