[erlang-questions] Why the compiler doesn't complain!

Ali Yakout ali.yakout@REDACTED
Tue Jan 15 08:12:29 CET 2008


I came across some strange compiler behavior.

The compiler should display a warning if some clause can't match because
the previous one do.
And this is true for the following:

-record(state, {name, accountNo, input, pin}).

eval(Command, Args) ->
    io:format("Executing ~p ... ~n", [Command]);
eval({quit}, _) ->

8> c("me").
me.erl:7: Warning: this clause cannot match because a previous clause at
line 5 always matches

But, when adding a record to the match clause, it goes ok !

eval2(Command, #state{name = "erl"}) ->
    io:format("Executing ~p ... ~n", [Command]);
eval2({quit}, #state{name = "erl"}) ->

9> c("me").

Ali Yakout
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080115/aae2dbe7/attachment.htm>

More information about the erlang-questions mailing list