scryer-prolog
scryer-prolog copied to clipboard
initialization/1 directive does not sufficiently take meta_predicate/1 declarations into account
For example, with run.pl consisting of:
:- use_module(library(format)). :- meta_predicate g(:). g(Goal) :- portray_clause(Goal). run :- g(true). :- initialization(run). :- initialization(g(true)).
We get:
$ scryer-prolog -f run.pl user:true. true.
Whereas the expected output is:
user:true. user:true.
This is because run is equivalent (per definitionem) to g(true).
This issue is the reason for https://github.com/mthom/scryer-prolog/discussions/1931#discussioncomment-6583858.
Another example, which arises when the module wants to assert (generated) clauses:
:- module(m, [run/0]). run :- p. :- initialization(assertz((p :- true))).
Unexpectedly yielding:
?- run. error(existence_error(procedure,p/0),p/0), unexpected. true. % expected
Earlier versions of library(clpz) assert clauses in this way and it used to work, and I can now no longer test them due to this issue.