Re: Feature Request: Improved detection of Singleton variables

From: Joachim Schimpf <j.schimpf_at_icparc.ic.ac.uk>
Date: Fri 08 Jul 2005 11:18:23 AM GMT
Message-ID: <42CE60FF.2030100@icparc.ic.ac.uk>
Ulrich Scholz wrote:
> 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.

A good place to add this feature would be library(lint), which
is distributed in source form and quite easy to extend.

Any takers?


-- 
  Joachim Schimpf              /             phone: +44 20 7594 8187
  IC-Parc                     /      mailto:J.Schimpf@imperial.ac.uk
  Imperial College London    /    http://www.icparc.ic.ac.uk/eclipse
Received on Fri Jul 08 12:20:06 2005

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