Why do some people shun `if`?

Michael P. empro2@REDACTED
Sat Aug 14 23:44:58 CEST 2021


I once stumbled over someone's Erlang style guide,
they wanted no `if`.
It was not very well explained why,
and there was no obvious e-mail address,
or I wanted to first do
some thorough thinking about it.
Now I have no more than this:

Is if not merely "syntactic sugar" for
a fun/0 with guarded clauses?
```
Now_this_is = (fun If() when Guard_seq_1 -> Expr_seq_1
                %% On and on and on
                 ; If() when Guard_seq_N -> Expr_seq_N
               end)(),
% or:
Worst = case true
          of true when Guard_seq_1 -> Expr_seq_1
           ; true when Guard_seq_2 -> Expr_seq_2
         end.
```
What could be perceived as wrong with `if`?

~M

--

But who will test the tests?








More information about the erlang-questions mailing list