Deprecating if then else
I believe that IF-THEN-ELSE
is too low-level and too ad-hoc.
IF-THEN-ELSE
grew out of COND
which was intended to represent conditional values of functions.
Programmers, though, extend the use of IF-THEN-ELSE
by coupling it with variables to create ad-hoc, custom control-flow constructs.
The emergence of various map() functions and case-ing based on pattern-matching is a workaround for incrementally replacing use-cases of IF-THEN-ELSE
.
Let’s just go all the way. Let’s use parsers to provide syntactic pattern-matching. That’s probably expressive enough. If not, we can add semantic and type-based pattern-matching.
Replace control-flow uses of IF-THEN-ELSE
by a parse. Leave COND
alone, for determining conditional values of functions, but, not for control flow.
Historically, it’s been a tough slog to build parsers, but, OhmJS (and PEG) make this task massively easier.
Appendix - The Power of Ohm and PEG
see 2024-04-06-The Power of Ohm and PEG
Appendix - See Also
References
https://guitarvydas.github.io/2004/01/06/References.html
Blog
Blog
obsidian blogs (see blogs that begin with a date 202x-xx-xx-)
Videos
videos - programming simplicity playlist
Pamphlets
Discord
Programming Simplicity all welcome, I invite more discussion of these topics, esp. regarding Drawware and 0D
@paul_tarvydas