Skip to content
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

(+\)/2 in call/1 confused predicate calls #2255

Open
bakaq opened this issue Dec 28, 2023 · 8 comments
Open

(+\)/2 in call/1 confused predicate calls #2255

bakaq opened this issue Dec 28, 2023 · 8 comments

Comments

@bakaq
Copy link
Contributor

bakaq commented Dec 28, 2023

?- [user].
:- use_module(library(lambda)).

p.

?- Goal = (X +\ p), call(Goal).
   error(existence_error(procedure,p/0),p/0).
?- Goal = (X +\ (user:p)), call(Goal).
   Goal = X+\(user:p).

This seems to be the ultimate cause for aarroyoc/scryer-playground#20. I couldn't reduce this for a custom predicate instead of (+\)/2, so I guess the problem is there, maybe in no_hat_call/1?

@bakaq
Copy link
Contributor Author

bakaq commented Dec 28, 2023

Also, this works for some reason:

?- call(X +\ p).
   true.

@infradig
Copy link

$ scryer-prolog
?- [user]. :- use_module(library(lambda)). p.

?- Goal = (X +\ user:p), write_canonical(Goal), nl.
:(+(_74543,user),p)
Goal = X+\user:p.
?-

@bakaq
Copy link
Contributor Author

bakaq commented Dec 28, 2023

That doesn't seem to be the problem:

?- Goal = (X +\ (user:p)), write_canonical(Goal), nl, call(Goal).
+\(_43,:(user,p))
   Goal = X+\(user:p).

@UWN
Copy link

UWN commented Dec 29, 2023

Works in SICStus. If at it, the existence error produced by Scryer does not reveal the actual module where the error occurs, which makes diagnosing difficult.

@hurufu
Copy link
Contributor

hurufu commented Sep 6, 2024

I think this is still not fixed fully:

?- use_module(library(lambda)).
   true.
?- [user].
p.
same(A,A).

?- X = (_+\p), same(X, Y), call(Y).
   error(existence_error(procedure,p/0),p/0). % unexpected
?- X = (_+\p), call(X).
    X = _A+\p.   % expected
?- 

UPDT: I've found this behavior during learning semantics of goal expansion for #2532

@UWN
Copy link

UWN commented Sep 6, 2024

Same problem when all is dynamic:

?- asserta((t2:-X=(_+\p),call(X))).
   true.
?- t2.
   error(existence_error(procedure,p/0),p/0).
?- p.
   true.

@UWN
Copy link

UWN commented Sep 6, 2024

Even

?- asserta((t3:-call(_+\p))).
   true.
?- t3.
   error(existence_error(procedure,p/0),p/0).

@bakaq
Copy link
Contributor Author

bakaq commented Sep 8, 2024

What in tarnation!!????

?- [user].
:- use_module(library(lambda)).

p.

a(\p).

?- G = (\p), call(G).
   G = \p.
?- a(G), call(G).
   error(existence_error(procedure,p/0),p/0).
?- a(G0), G = (\p), G0 = G, call(G).
   G0 = \p, G = \p.
?- a(G0), G = (\p), G0 = G, call(G0).
   % G0 and G unified, why does one work and the
   % other give an error!!?? 
   error(existence_error(procedure,p/0),p/0).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants