From f7214090cbcd3b3792b76527de24e373bddbb9d7 Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Tue, 17 Nov 2009 00:59:06 +0000 Subject: [PATCH] make operators defined within a module local to the module, operators in header are still global to every module, though (UN #131). --- pl/modules.yap | 2 +- pl/utils.yap | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pl/modules.yap b/pl/modules.yap index ec73a7bd8..b255f2f38 100644 --- a/pl/modules.yap +++ b/pl/modules.yap @@ -94,7 +94,7 @@ module(N) :- Arity2 is Arity+2, '$process_exports'(Exports,Mod,ExportedPreds). '$process_exports'([op(Prio,Assoc,Name)|Exports],Mod,ExportedPreds) :- !, - op(Prio,Assoc,Name), + op(Prio,Assoc,prolog:Name), '$process_exports'(Exports,Mod,ExportedPreds). '$process_exports'([Trash|_],Mod,_) :- '$do_error'(type_error(predicate_indicator,Trash),module(Mod,[Trash])). diff --git a/pl/utils.yap b/pl/utils.yap index 8a3544523..e4f1df955 100644 --- a/pl/utils.yap +++ b/pl/utils.yap @@ -95,6 +95,10 @@ op(P,T,V) :- '$op2'(P, T, A), '$opl'(P, T, As). +'$op2'(P,T,A) :- + atom(A), + prolog_load_context(module, Mod), Mod \= user, !, + '$opdec'(P,T,A,Mod). '$op2'(P,T,A) :- atom(A), !, '$opdec'(P,T,A,prolog).