[erlang-questions] Guards syntax for multiple values

Mikael Pettersson mikpelinux@REDACTED
Wed Mar 27 09:57:38 CET 2019


Instead of focusing on syntax, people should focus on semantics.

The basic problem is the very presence of so-called "guard
expressions", as a highly restricted subset of the general set of
expressions.  The guard expression restriction is only needed in
receives, to ensure that the mailbox doesn't change as a side-effect
of evaluating the pattern match + guard combination.  In other
contexts, guards could be fully general boolean expressions -- only
historical reasons prevent them from being so.

Personally I tend to write code to dispatch on the result of
classification functions instead of relying on complex guards.



More information about the erlang-questions mailing list