Wish: Variable Not Used Warning

Manfred_Nowak svv1999 at hotmail.com
Wed Jul 9 02:17:50 PDT 2008


Nick Sabalausky wrote:

> turned out to be variables I had intended to use but forgot to

I am trying to tackle such time wastings with "protocols" in drokue. If 
one would be able to formally attach ones intentions to variables then 
such bugs could possibly be prevented.

In your case the intention might have been to write and read the 
variable several times, of course starting with a write followed by 
some read. This intention can be expressed by a regular expression 
like:

   write+ read ( write | read )* 

For evaluating this at runtime (!) one may attach a DFA to the 
variable---a DFA that interpretes the operations on the variable as 
input. Of course the DFA has to be initiated somewhere before the first 
operation on the variable. At program termination the DFA can than be 
checked, whether it is in a final state.

If at program termination the DFA is not in a final state then an 
"intention violation"-error can be reported. This way your time 
wouldn't have been wasted.

Please note, that such cannot be done by a lint tool.

-manfred 
-- 
Maybe some knowledge of some types of disagreeing and their relation 
can turn out to be useful:
http://blog.createdebate.com/2008/04/07/writing-strong-arguments/



More information about the Digitalmars-d mailing list