-
Notifications
You must be signed in to change notification settings - Fork 139
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
Module qualifications not resolved at runtime #2826
Comments
Regarding the footnote, maybe #2811? |
The WAM instructions look sensible, so there is hope that the issue is limited to the interpreter: For instance, when I define: p(M) :- M:p. I get: ?- wam_instructions(p/1, Is), maplist(portray_clause, Is). dynamic_else(1,inf,0). put_structure(:,2,x(1)). set_local_value(x(1)). set_constant(p). execute(call,1). It seems to correctly call But, I unexpectedly get: ?- p(a). error(type_error(atom,... :a),call/0), unexpected. |
Even more so:
So there is some premature expansion of |
This seems to be a good workaround for now: ?- Module = a, G0 = Module:a(A), call(G0).
Module = a, G0 = a:a(1), A = 1. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It seems that module qualifications are resolved at compile-time1, and variable module qualifications are just ignored:
This quite limits the kind of things you can do with that, and makes this pattern currently used in the test suite useless, because only the tests visible in the unqualified module are found, instead of only the tests visible in the qualified module (which is the intended behavior).
I found this while adapting that test framework into something to be provided by the Scryer Prolog standard library.
Footnotes
Actually, I think at expansion-time, because if I remember correctly that is when module qualifications are dealt with. I think I even remember seeing the specific code that ignores variables once. ↩
The text was updated successfully, but these errors were encountered: