-
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
meta_predicate/1 directive is sometimes not applied #2625
Comments
Meta-predicate argument expansion is applied only per goal, and not on a term level – this is the root of a problem. You can check it for example by adding the following to your snippet: :- dynamic(t/0).
t :- p(t). And then doing following query.
|
@hurufu: What you posted does not correspond to the example in the issue, please try it with: t :- p(_). |
Ah yes, but it is still quite hard to solve with current loader in a systematic way and without pilling-up workarounds on top of workarounds. I think I can do a warning in this case, as was suggested recently. |
Interestingly enough the following code: t :- p(_). Already triggers a warning:
This happens because |
Actually I've tested this situation a little bit more, and I think the problem is more subtle. The following code behaves as expected: :- module(m, [p/0]).
:- meta_predicate(b(:)).
b(t).
p :- b(X). Query:
|
Because there is no distinction between |
By "no distinction" I mean that |
I have found a workaround: :- meta_predicate(q(0,-)).
q(A,A).
p(A) :- q(t, A). Now it works as expected:
Because module qualifier are added in the place of call, this means that for original example, there was no enough information whether to add or not those qualifiers. |
I've actually have spent some time trying to write a warning, but I'm kinda stuck. Consider the following code:
First clause of |
I am filing the short example from #2624 (comment) here as a simpler issue. With:
We get:
Reason: The call is expected to be
user:X
, and thus not unifiable witht
.The text was updated successfully, but these errors were encountered: