Sorry. Late … Indeed, this doesn’t work. I think Logtalk has extends
for that. In plain SWI-Prolog you can get this to work, but the rules look a bit ugly. Sure you can write term expansion rules to deal with that though.
edit (this is not the only way)
rules.pl
:- module(rules,
[ rule/1
]).
:- meta_predicate
rule(:).
rule(M:X) :- M:fact(X).
fact1.pl
:- module(fact1,
[]).
:- use_module(rules).
fact(sure).
Running …
swipl rules.pl fact1.pl
?- 1 ?- fact1:rule(X).
X = sure.