Feature Request: Improved detection of Singleton variables

From: Ulrich Scholz <ulrich.scholz_at_eml-d.villa-bosch.de>
Date: Wed 06 Jul 2005 03:04:26 PM GMT
Message-ID: <20050706150426.GB6413@eml-d.villa-bosch.de>
Dear all,

the detection of singleton variables by the ECLiPSe compiler is useful in
finding bugs.  But sometimes this mechanism fails to find such variables.
Consider the following example:

test(A, B, V1) :-
        
    (A == B ->
       V2 = 'yes'
    ;
       V2 = 'no'
    ),
    writeln(V1).

Variable V2 is never used twice, thus could be called a singleton variable.  
Unfortunately, V2 is not detected as such.

I just experienced such a bug (typo + copy&paste) buried deep in a system.
Took me a while to find it.


The detection of such singleton variables would be a valuable extension.


Regards, Uli    
-- 
Ulrich Scholz            

Personal Memory Group                   
European Media Laboratory GmbH
Received on Wed Jul 06 16:11:05 2005

This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:07:37 PM GMT GMT