I am wondering if pred5 should also raise a warning because the same variable name is used as-is and “underscored”. What do you think?
a :- pred1(Flags). % singleton
a :- pred2(_Flags). % no warning
a :- pred3(_Flags, _Flags). % "multiton"
a :- pred4(_Flags, Flags). % singleton
a :- pred5(_Flags, Flags, Flags). % should this raise a warning?
Surely the current behavior is on purpose. Flags and _Flags have no relation to one another. Thus, in pred5 there is _Flags as a singleton, which is fine and two instances of Flags, which is fine too.
Of course, one could argue that if _Name is there only to avoid a singleton warning it is a good idea to have a warning if both _Name and Name appear in a clause. This would require another type of message
The main question is whether this is a common (enough) problem to justify the check and explain it? Experiences?
I’ve made this mistake from time to time, or something similar, typically when I’m modifying existing code by adding parameters or an intermediate goal, especially for debugging. Next time I encounter it, I’ll try to remember to write down the sequence that led to the mistake.