[erlang-questions] What is wrong with this list?
Ulf Wiger (TN/EAB)
ulf.wiger@REDACTED
Wed Sep 5 10:46:39 CEST 2007
attila.rajmund.nohl@REDACTED wrote:
> 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) ...
The compiler does issue warnings whenever it can detect
that a clause will not match.
Specifically:
-module(warns).
-compile(export_all).
f() ->
[java|python] = [1,2,3,4,5].
results in this warning:
11> c(warns).
./warns.erl:6: Warning: no clause will ever match
{ok,warns}
The initial post in this thread showed a failed
pattern match in the _shell_. That code would
have triggered a warning if compiled.
BR,
Ulf W
More information about the erlang-questions
mailing list