Context module and module prefix attached to arguments [Q]

Hi,

Let me give a simple example to explain my question about module.

:- meta_predicate user:a(:).
user:a(X) :- writeln(X).
?- module(b).

?-  a(c).
%@ b:c
%@ true.
?-  user:a(c).
%@ user:c
%@ true.

To me a and user:a in this example should be referred to a same
predicate, and equivalent predicates should behave
equivalently. But, the above example does not fit to this principle.

This question is not new for me, but so far I have not met any clear
explanation about this question. Perhaps I am missing some basics
about module.

Thanks for making clear this in advance,

Kuniaki Mukai

Perhaps you are missing that a call Module:Goal does two things: it resolves Goal in Module (i.e., finds the definition there) and it sets the calling context to Module, which causes the user:c. That is how it is defined in Quintus-derived module systems. There is a predicate @/2 that allows you to specify the context explicitly. It is very rarely used though.

Bottom line: the Quintus derived module systems discourage the use of explicitly quantified goals. Import the definition and call it. The qualification is targeted at debugging and special use cases.

Thanks Jan,

Personally I am not satisfied with such Quintus derived way of qualifying arguments of meta predicate calls because of what I wrote. However the builtin @/2, which I am not aware of, seems to fill the gap between the Quintus default way and what is necessary for me with my pack/pac, which asserts expanded anonymous predicates into their context modules.

Thank you for clarification and letting me know @/2.

Kuniaki Mukai