Erlang: Danger of Mixing Records and Tuples

I received an error from the erlang compiler: “Warning: this clause cannot match because a previous clause at line 387 always matches” and was staring at the code trying to figure out why the top clause was a ‘catch all’.

case Result of
    {Version, NewId, ConnectionStates, NextProtocol} ->
        ....
    #alert{} = Alert ->
        ....

so #alert has 3 fields so is always matched by the 4 field tuple. :(

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s


Follow

Get every new post delivered to your Inbox.