[erlang-questions] Illegal Guard?

ok@REDACTED ok@REDACTED
Sun Feb 14 00:37:08 CET 2016


> Richard,
>
> Why do you think "f(X, Y) when U = X+Y, U > 0 ; V = Y*X, V < 0 ->" is
> wrong?

Because the language specification and the compiler say it is.

I said that something like that creates problems in the same way
that case ?? of ?? -> U = X+Y ; ?? -> V = Y*X end
creates problems.  It can be addressed the same way.

For what it's worth, I personally believe that allowing = in
guards would be an improvement to the language.  It would
certainly make some guard macros easier to write.
>
> I do think that this is ugly, and diminishes the boundary between function
> body and function header, and leads to cluttered programs.

Leads?  I'd say "can lead".  A lot of things can lead to cluttered
programs.

But this is far from the most pressing issue in Erlang.





More information about the erlang-questions mailing list