[erlang-questions] Warning not emitted on string matching clauses

Anthony Ramine n.oxyde@REDACTED
Wed Apr 8 09:52:29 CEST 2015

Le 8 avr. 2015 à 08:46, Erik Søe Sørensen <eriksoe@REDACTED> a écrit :

> It would of course make sense to have the compiler warn in this case.
> However - if my understanding of the compiler implementation is correct - matching of binaries is handled specially, and apparently in such a manner that it doesn't realise that the two binary patterns are identical.
> /Erik

That would be a reasonable explanation, but unfortunately it's not the case. If you compile that module to BEAM assembly, you can see very that the two patterns are indeed merged together, there is only one occurrence of "user_auth" in it.

{function, authenticate_nouns, 1, 2}.

More information about the erlang-questions mailing list