4 ms·
> That's why "expression-oriented" Erlang (and Elixir) simply has the single-branch if while the academics still debate whether or not it should Erlang's singl
by masklinn 4y ago
> That's why "expression-oriented" Erlang (and Elixir) simply has the single-branch if while the academics still debate whether or not it should
Erlang's single-branch if is essentially an assertion, it throws if the one branch is not taken.
I don't find this very pragmatic, or even at all useful since erlang ships with a slew of assertion macros (https://www.erlang.org/doc/man/assert.hrl.html https://www.erlang.org/doc/man/assert.hrl.html).
Your "pragmatic" also doesn't do anything useful for a statically typed language. A statically typed language requires that the program be well-typed, so you have to define what "well typed" implies for a single-branch if.