Notwithstanding the visibility rules, any predicate can be called from any other module by prefixing the goal with the module name and the colon operator, thus overriding the source module of the goal:
| ?- foo:bar(X).
This feature is intended mainly for debugging purposes, since it defies the purposes of the module system. If the prefixed goal is a meta-predicate, however, the prefixed module name may affect the module name expansion of the goal (see Meta Exp). If multiple module prefixes are used, the innermost one has priority.
It is also possible to override the source module of clauses and directives by module prefixing. For example,
:- dynamic mod:p/1. p(X) :- mod:(q(X), r(X)). mod:(q(X) :- r(X)). mod:s(X) :- t(X).
declares mod:p/1
as dynamic, whatever the source module is;
defines p/1
in the source module as calling mod:q/1
and
mod:r/1
; defines mod:q/1
as calling mod:r/1
; and
defines mod:s/1
as calling t/1
in the source module.
The latter technique is particularly useful when the prefix is
user
and the predicate is a hook predicate such as
user:portray/1
which must be defined in the user
module,
but the rest of the file consists of predicates belonging to some other
module.