Singleton variable in branch: right warning message?

Parker Jones <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <[email protected]>
This code gives the warning "Singleton variable in branch: A", but shouldn't it be a regular singleton warning?


p(X) :-
    (X > 0 ->
        A=1
        ;
        A=0
    ).
I spent time trying to figure out 
which branch was to blame (in more complex code), when in fact the branches are fine, it's just
 that the variable isn't used afterwards.


p(X) :-
    (X > 0 ->
        A=1
        ;
        A=0
    ),
    write(A).   % use variable A and the warning goes away.

Cheers,
Parker
 		 	   		  
-------------- next part --------------
HTML attachment scrubbed and removed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.