[erlang-questions] true

Thu Mar 28 15:16:21 CET 2019

On 2019年3月27日水曜日 18時21分36秒 JST Donald Steven wrote:
> As someone very new to Erlang, I find it interesting to follow the 
> discussion on guards.
> FWIW, the *only* thing about Erlang that drives me to distraction is the 
> use of the atom 'true' as a reliable "or, if the above ain't so" default 
> value for the expression.  If only (how I wish it were so) the atom 
> wasn't so often completely at odds -- and at times the inverse -- of the 
> normal English 'read' of the if expression.  Please consider 
> grandfathering 'true' (not to break old code) and coming up with a 
> logically less committed atom-of-the-future such as 'default' or 
> 'otherwise'.

Use `case` and general matching instead of `if` and other boolean constructs
and your life will be better.

In Erlang boolean comparison constructs apply mostly in *range* comparisons,
not general comparisons. `if` means something *very* different in Erlang
than you're used to.


More information about the erlang-questions mailing list