not quite a bug, but...

Vlad Dumitrescu vlad_dumitrescu@REDACTED
Thu Mar 21 09:11:53 CET 2002


Hi all,

I have found a bug in our code that wasn't easy to spot, and I wonder if the 
compiler shouldn't issue a warning...

The faulty code was:
	case NewTime = 0 of
		true -> ...
		false ->
	end,

When one has to scan heaps of code, it isn't easy to see that there should 
be a "==" instead. The compiler however might realize that this construct 
will never do anything useful.

While it is correct Erlang, it is against good coding style and in this case 
plain wrong. My question is, wouldn't it be nice to be able to catch that 
kind of errors when compiling? Since the right hand side of the "=" is a 
constant, as are the case discriminators, it is easy to check if they are 
compatible.

Or maybe as a wild idea, erl_lint could get an open API where one could add 
one's own modules? (Not a job for the weak of heart to write such a module, 
but maybe useful) Of course, one can scan the files separately, but it would 
be better to integrate this in the build process.

best regards,
Vlad



_________________________________________________________________
Chatta med vänner online, prova MSN Messenger: http://messenger.msn.se




More information about the erlang-questions mailing list