A design that subsumes the various syntactic forms of
if
statements/expressionsswitch
on valuesmatch
on patterns and pattern guardsif
-let
constructs
and scales from simple one-liners to complex pattern matches.
A design that subsumes the various syntactic forms of
if
statements/expressionsswitch
on valuesmatch
on patterns and pattern guardsif
-let
constructsand scales from simple one-liners to complex pattern matches.
Sure, there are some worse/more limited predecessors – my design was partially motivated by a desire to improve upon these.
For instance, that ML-derivative you are using for your examples
if then else
in the language, thus making it not unifiedmatch
is very limited in which coding patterns it can expressAlso, none of the examples are “more clear” or “have less magic”:
Maybe they are more “familiar” to you personally, but that’s about it.
Too me they just look clunky, full of accidental complexity and trying to work around a poor/limited language design.