-
Notifications
You must be signed in to change notification settings - Fork 136
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
meta_predicate/1 directive sometimes unexpectedly has no effect #2745
Comments
As an addendum, what I actually wanted to test in this case is whether the module prefix is not added in cases where it can be rightfully omitted. For instance, consider the well-known definition of :- meta_predicate(maplist(1, ?)). maplist(_, []). maplist(G_1, [L|Ls]) :- call(G_1, L), maplist(G_1, Ls). In this case, even though That is what I wanted to test, and it appeared to work, but only because Scryer apparently never adds the module qualifier at all in such cases, hence the issue. If anyone has any feedback on this point, please go ahead. Thank you a lot! |
I think the code that adds module specifiers isn't that advanced yet. It has a lot of quirks like this. |
I couldn't find where the code for adding module specifiers lives in the project (which is currently blocking me on #2738 to cleanly let |
It is done in loader.pl if I'm not missing anything. Here is a call graph if it can help you with reading it: #2604 (comment) UPDT: To be more precise you can take a look into |
I second For example, with the above definition of ?- loader:expand_goal(maplist(goal, []), test, G). G = maplist(test:goal,[]).
For example, with :- module(m, []). :- use_module(library(format)). :- initialization((prolog_load_context(module, M),portray_clause(M))). we get: $ scryer-prolog m.pl m. |
While considering #2738, I ran into a case that came as a surprise to me because the
meta_predicate/1
directive unexpectedly has no effect.As an example, consider
mycall/1
declared as a meta-predicate, with its single argument denoting a goal that is meant to be invoked verbatim (i.e., without adding arguments), andp/0
defined in total as:Let's look at the listing of
p/0
:We see that the
user:
module prefix is added to the argument of the firstmycall/1
goal, as expected. But for the secondmycall/1
in the clause body, no module prefix is added! This is unexpected; I expected the second goal to readmycall(user:A)
. Note that the goal (i.e.,A
) is againt
, so we expect both invocations ofmycall/1
to be equivalent and the module prefix therefore present in both cases identically.The text was updated successfully, but these errors were encountered: