[erlang-questions] What is wrong with this list?

attila.rajmund.nohl@REDACTED attila.rajmund.nohl@REDACTED
Wed Sep 5 10:18:17 CEST 2007


On Tue, 4 Sep 2007, Dustin Sallings wrote:

>
> On Sep 4, 2007, at 13:29 , Peter K Chan wrote:
>
>> I think it would be nice if the compiler can output why a match fails (e.g. 
>> {number, 1} does not equal {atom, java}).
>
> 	This could work as an error string along with the badmatch for the 
> single case discussed, but what about a case (that is contrived, but probably 
> similar to real code I've written somewhere) like this:
>
> 	Pid = some_function(),
> 	Pid = other_function().
>
> 	The error message wouldn't be all that useful to you either way 
> because on the first line you're capturing a value into a variable, and on 
> the second line you're validating the same Pid is returned.

This is a case where the line number information could be useful. Also a
warning might be useful during compilation time, a same kind of warning
that you get in C for code like
if (a=b) ...
 				Bye,NAR
-- 
"Beware of bugs in the above code; I have only proved it correct, not
  tried it."



More information about the erlang-questions mailing list