scryer-prolog icon indicating copy to clipboard operation
scryer-prolog copied to clipboard

`current_predicate` ignores calling context

Open rotu opened this issue 6 months ago • 0 comments

current_predicate/1 seems to list the predicates in the user module, not the calling module.

:- module(test, [exported_predicate/0, cur/1]).
private_predicate :- true.
exported_predicate :- true.

:- dynamic(dynamic_predicate/0).
dynamic_predicate :- true.

cur(X) :- current_predicate(X).
$ scryer-prolog -g 'use_module(test,[cur/1]),findall(P, cur(P), Ps),writeq(Ps),halt.'
[term_expansion/2,verify_attributes/3,goal_expansion/2,project_attributes/2,attribute_goals/3,repl/0,cur/1]

Note that neither private_predicate/0, dynamic_predicate/0, exported_predicate/0 are visible even though they are present in the foo module. Note too that repl/0 is shown, even though it is not imported into the test module and should not be visible.

rotu avatar Jun 18 '25 20:06 rotu