[erlang-questions] Order of evaluation of guards
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
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.
On 6 January 2015 at 19:25, Thomas Lindgren <thomasl_erlang@REDACTED>
> 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
> erlang-questions mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions