[erlang-questions] Order of evaluation of guards

Robert Virding rvirding@REDACTED
Tue Jan 6 20:02:44 CET 2015


Guards were added as an extension to pattern matching, a way of expressing
things which could not comfortably done by extending the pattern syntax,
for example saying that something had to be an atom or greater then 5.

The original guard syntax was different from standard expressions in many
ways and much more restricted than today so the difference was clearer.
There was less chance of confusion, expressions were expressions and guards
were guards.

It was making the guard syntax completely the same as expressions and
adding things like logical expressions which made the difference less clear
and things became more confusing. And calling them guard *expressions*
instead of guard *tests* does not help.

I think it is very important to stress that the guard and the body of a
clause are very different beasts and obey different rules. Adding a proper
'cond' might help. All in IMAO.

Robert


On 6 January 2015 at 19:25, Thomas Lindgren <thomasl_erlang@REDACTED>
wrote:

> Guards are a mess IMO, for reasons including, but not restricted to, the
> ones you mention.
>
> Your example suggests that member/2 could be a useful new guard operation
> though.
>
> Best,
> Thomas
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150106/49bda480/attachment.htm>


More information about the erlang-questions mailing list