-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(playground) use module import of overridden predicate #61
Comments
Yes, you can do it no problem: :- module(foo,[main/0,tab/1]).
main :-
tab(4),
write(a).
tab(X) :- Y is X, io_basic:tab(Y). and now: ?- use_module('/draft.pl').
{Compiling /draft.pl
WARNING: (lns 2-5) Unqualified predicate call to tab/1 assumed to local version, calls to predicate imported from io_basic must be qualified
}
yes
?- draft:tab(3+2), write(a).
a
yes If you want to avoid the warning when compiling the module you can do: :- module(foo,[main/0,tab/1]).
main :-
foo:tab(4),
write(a).
tab(X) :- Y is X, io_basic:tab(Y). or use use :- module(_,[main/0,tab/1]).
main :-
tab(4),
write(a).
:- redefining(tab/1).
tab(X) :- Y is X, io_basic:tab(Y). In the top level: ?- use_module('/draft.pl').
yes
?- draft:tab(3+2), write(a).
a
yes |
Note that predicates are never overridden, so the problem may be in the predicate visibility rules. :- module(a, [foo/1]).
foo(a). :- module(b, [foo/1]).
foo(b). ?- use_module(a).
yes
?- foo(X).
X = a ?
yes
?- use_module(b).
yes
?- foo(X).
X = a ?
yes As @mherme says both |
With Novacore and Liblets its not needed anymore. |
OK. I'll mark this as 'wontfix' and cite from another issue. |
While trying to port:
I was running into a predicate lookup problem. I tried the following:
But the top-level cannot resolved the overridden tab/1:
This works in other Prolog systems that have a module system.
The text was updated successfully, but these errors were encountered: