scryer-prolog
scryer-prolog copied to clipboard
Branch singleton variables warnings would be useful
For instance, in the following program, Z is a branch singleton variable: In every branch it occurs, it occurs only once.
p(X) :-
( true ->
X = Z
; X = Z
).
A warning about such branch singleton variables would be useful. Currently, we get no warning at all, because Z is not a singleton variable since it occurs more than once in the clause.
Does only (;)/2 predicate introduce branches? Or something else can too? I think lambdas can be tricky...
(;)/2 is no doubt the context in which such a mistake is most likely to be encountered and would be most useful to detect.