News for hackers. Stuff that matters.
Re:Optional If Expressions by masklinn on Saturday April 15, 2023 @06:22AM (#35579245)
> 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 useful, or pragmatic, especially since erlang ships with a slew of assertion macros (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.

There are no comments on this comment yet.