414 points · by fanf2 · 5y ago · 248 comments
There were a few interesting observations. The one that stuck with me the most is that 'and' is most commonly used with almost the opposite sense in natural language vs programming: more precisely, in natural language, 'and' usually implies set union, which is more similar to boolean Or. For example, 'women and children' means of course 'if X is a woman OR X is a child'.
The other interesting observation was that in natural language we usually describe operations on sets as taking the whole set as an argument, not in terms of what happens with each individual member. For example, it's more likely you'll say something like 'give candy to these kids' or 'wash these cars' than 'give a piece of candy to each kid' or 'wash each of these cars'. Of course, index based loops are essentially never used in common language, but even the common loop comprehensions that introduce a loop variable are quite far from natural language.
Set union: they can read and write’
Set intersection: my jeans were creased and dirty
Sequential: he turned round and walked out
Causal: there was a flash flood and by the next morning the town was under water’
And, there are many more usages.
"Women and children were present" isn't saying the intersection of the women and children were present but that the things were women and children and they all were present.
The rest of the variety of "meanings" of "and" are just inferences on top of this basic meaning. If things occur in sequence, for instance, we can infer causality from what we know about the things conjoined apart from the conjunction.
Crucially, there is more here than just "joining multiple clauses together" (and many of the things conjoined aren't clauses), because "or" can be described this way too, but "and" does not mean the same thing as "or". With "or" you are only asserting that some of the propositions are true.
1) not every clause is a predicate and applying logical operators to a non-predicate makes very little sense to me.
2) I don’t see how ordering, time, and causation can be inferred, if you treat each clause as a predicate.
“I punched Bob and apologized” has a different meaning than “I apologized, and punched Bob.”
The AND as used in logics simply doesn’t embody this usage.
—-
It was a sloppy wording of mine to say that AND just join clauses together. I meant to say that it joins clauses together, and the relations between the clauses are not necessarily set union. Of course it can’t embody all relations, but more than set unions.
The big difference I see is with 'OR' in programing the options are exclusive. Ex: "Are you tired or hungry" The answer is yes if you are tired. Yes if you are hungry, Yes if you are both. No if you are neither. This is natural English. In programming if you are both. The answer is No.(False)
Note that I’m not joining people with AND. I joined abilities.
For instance, to expand on the example.
I have three Pokémons. They can read and write.
I’m not saying that my three Pokémon are the intersection of reading Pokémon and writing Pokémon. There might be other Pokémon who can do just the same.
I’m saying that what they can do is a union of writing and reading.
EDIT: spelling
>> Set intersection: my jeans were creased and dirty
IMHO those are both unions. One describes two capabilities people have while the other describes two conditions some clothing has.
They both become intersection when using the pair of conditions as selection or decision criteria.
It's the difference between an assertion and a question.
This is of course related to why the famous joke "Is it a boy or a girl? Yes." is so hilarious.
You have to be very careful in reasoning about natural language based solely on the written record, since spoken language regularly includes features, such as the suprasegmentals (stress and intonation) in the above examples, that aren't recorded in the orthography.
Do you want to eat pizza or garlic bread? - exclusive
In natural language "and" works like a inclusive or. If there is pizza and garlic bread I can choose to eat one or both. Or is always exclusive in this sentence.
I used to drive my friend crazy when he would ask if I wanted a peanut butter and jelly sandwich or a ham and cheese sandwich and I would answer yes.
Somewhat related: the Ada language uses and, or, xor for its logical operators, but uses and then and or else for the short-circuit forms. [0] Not a very natural solution in my opinion.
[0] https://en.wikibooks.org/wiki/Ada_Programming/Operators#Shor...
Only to IT people though. Common folks will just look at you in a weird way...
But in this case there is actually a slight chance that nobody recognizes this as a joke at all...
"Do you like pizza, or?"
Depending on the exact statement, you might catch more or less flak.
English is way too ambiguous for this example and often relies heavily on context. Wanting to eat pizza does not preclude also wanting to eat pasta. If it was exclusive or, and you wanted to eat both pizza and pasta, the honest answer to this question would be "no," but what you should say is "yes."
Even sentences that on their face are strictly propositional will, in actual situated language use, have implied meanings (a pragmatic level). The canonical example is where one person says "It's cold" (at it's core a statement of fact), after which another person closes a window, or hands them a jacket, or follows with "Let's go home, then". If you want to give an account of natural language meaning that's even remotely complete, you cannot stop at what's in the sentence at the surface, you absolutely have to look at why it's being said.
Indeed, if you think of an actual situation where someone would say "do you want to eat pizza or pasta?", I think you'd find that it does, in fact, imply that the two are exclusive in that context - say if you're at a restaurant where they only expect you to order one main course. But this is not a problem at all, it's just how language works.
(And personally, on the subject of logic and language, I'd even go as far as to say that logic is based on natural language rather than the other way around, but I think that might be tough sell to the mathematically minded.)
It doesn't answer the question. The questioner is asking for your help in making a decision. If you are completely neutral about the two, then most people answer with the phrase, "Either one is fine". Saying just "yes" sounds like you misunderstood the question --- unless you say it with a wry smile, showing that you mean to be funny in your answer.
(I suppose occasionally someone could ask the question with a different inflection, with the last word at a higher pitch, meaning, "Are either of these fine with you?" rather than, "Please pick one.")
> Similarly with the boy or girl question, "no" may be stillborn.
The sex is set at conception.
That's one of the reasons I like functional programming. In ML-style languages you have something like `Set.map giveCandy kids`, which is both concise and close to natural language.
Comprehensions are also cool in my book, because they're very close to set-builder notation.
well, sometimes it can be syntactically ambiguous too, right?
e.g. "I welcome big and small dogs" vs "I welcome well-behaved and properly groomed dogs"
(I ate all the chocolate candies) and (I ate all the waffles)
I ate everything that was (chocolate candy and waffles).
In the first example, the intersection is in the set of things that happened. In the second, it is in the set of things.
It's merely a convention that "I ate all the chocolates and waffles" means the first of these while "I ate all the chocolate waffles" means the second.
This is similar to how even if means "power" unambiguously, 2 3 5 doesn't mean one thing until you put parentheses in (explicitly or by convention).
For example instead of saying "if not <condition>" you can also say "unless <condition>" which is more natural imo.
Both keywords work in postfix form, and this is how I usually use 'unless' so it reads more like a sentence.
do_thing() unless ($a == 1);
do_thing() if ($a != 1); unless a
a = 4
end
return x unless y
return zTrue but for more complex instructions, it’s common to say “do these things for that kid, then do that for all the kids”, which is pretty much a for loop. I can’t speak to how common this was in lay speech before programming was common though.
(There was an earlier thread about this but algolia’s search UI suddenly became a pain to use on mobile and it’s too tedious to find.)
Wasn't that the goal of Perl? It was inspired from natural language first, not inspired from another programming language first. This is why it's so quick and easy to prototype in it, arguably far easier than any other language. I believe it is the only programming language to be inspired from natural language first.
(((w ∨ c) → a) ↔ ((w → a) ∧ (c → a)))
That is, an implication whose antecedent is a disjunction is a conjunction of implications. On the other hand,
((a → (w ∨ c)) ↔ ((a → w) ∨ (a → c)))
That is, an implication whose consequent is a disjunction is a disjunction of implications.
candy | kids
Where candy and kids are self contained programs that already understand the operations which make up candy and kids.Reminds me of APL.
But I'm not sure APL can be considered being close to natural language.
That's something that array languages did right.
Doesn't R do it like that too?
Well, no, “women and children” alone doesn't mean that, “if X is a member of women and children” means “if X is in women OR X is in children”.
But that's consistent with AND and OR as boolean operators in programming (it's inconsistent with the way &-and-| symbols are used as set operators in some programming languages, though; ∪ and ∩ would be better, but aren't in ASCII.)
Sure you can!
Shakespeare used 'else' in the same sense as 'otherwise': https://www.shakespeareswords.com/Public/GlossaryHeadword.as...
"else used as a conjunction" https://wordtype.org/of/else
"Or else!" was common speech before computers, and a common vague cartoon/cowboy/sign threat.
[1] https://arstechnica.com/features/2020/12/a-damn-stupid-thing...
Certainly, from cumbria, it sounds quite natural also.
It's more spoken dialect than written. "What else do you want to do?" etc.
The article was fascinating, especially the historical examples from different programming languages, and I buy the plausibility of a German speaker using “else” this way... I work with German speakers and they do it all the time. From the small amount of German I know, it feels like there might be some parallel with “als”. Another common one they use that’s less common with English speakers is starting a sentence with “Means”, as opposed to “It means” or “That means”. It’s not incorrect, but it does sound different.
I just don’t think the German speaker explanation is the only possible one, because there absolutely is precedence for the English use of ‘else’ as a conjunction. Usage of ‘else’ with ‘or’ also makes some plausible sense here too...
I‘m a native German.
It was certainly not „als“ as this translates to either „than“ as in „more than“ or „when“ as in „when I came home“.
My guess is that the original German text used „falls“ for „if“ and „sonst“ for „else“:
„falls A > 0 dann X“
„sonst Y“
"Pay for your beer. Else, leave this place at once!"
Though: else as a conjunction isn't quite archaic today. But, it is one of those usages that when I encounter it, I begin to suspect that the document I'm reading is rather old.
So I firmly believe they used "sonst".
“wenn a b ==...”
in fact, Germans would say (and do say, e.g. in mathematics) "wenn a gleich b" as a shorthand for "wenn a gleich b ist".
In the late 1960s and early 1970s, it was a big debate if programmers should use structured programming, building programs out of blocks with control structures such as iteration and conditionals. (Earlier programs were built from ad hoc control using goto.) This is the context of Dijkstra's famous "Go To Statement Considered Harmful.
Although structured programming seems obvious now, there was a lot of resistance. At first, people weren't even sure if structured programming could implement all the required control flows, so someone (Böhm–Jacopini) had to prove the "structured program theorem". Languages needed to be modified to support structured programming, e.g. adding block if-else to Fortran 77.
I have to wonder what modern programming debates will seem as obvious in retrospect as the victory of structured programming.
Personally I think it's just that most people are not good at adapting to new contexts that evolve. And people are not really evaluating things rationally. For example, in the beginning those types of programming languages were completely infeasible to implement due to hardware constraints. So people were not used to them. That created a type of prejudice.
Another example. Look at CISC versus RISC. When the context is raw machine code or assembly language, you absolutely want more complex instructions because otherwise programmers are going to a competitor that provides them.
But then when you have high-level languages that part of the equation changes and reducing instructions gives other advantages.
Neural networks might be another example of an advance that was shunned initially.
> 1903, Jack London, The Call of the Wild, Grosset & Dunlap, page 44:
> […] and his first experience taught him an unforgetable lesson. It is true, it was a vicarious experience, else he would not have lived to profit by it.
As an aside there is at least one common word which does seem to have been invented by the software industry: "access" as a verb
The comic Calvin & Hobbes corroborates the novelty of this verb in this strip from 1993: https://www.gocomics.com/calvinandhobbes/1993/01/25
Really? That’s surprising because the French and Spanish equivalent verb (accéder / acceder) is common and has multiple meanings such as “reaching a peak”. I would have imagined this word transferred over in the Norman days.
Examples: "Go to college or else work for your uncle"
Turn this into boolean form: "If you go to college then <foo> or else you will work for your uncle"
But the "or" makes the meaning ambiguous: "If it rains then I will work inside or else I will work outside."
It is not clear if this means you will work outside if and only if it is not raining? Maybe working outside is another option if it rains.
Otherwise is far more clear. "If it rains then I will work inside otherwise I will work outside."
Removing the "or" completely makes the statements unambiguous archaic English: "If you go to college then <foo> else you will work for your uncle" "If it rains then I will work inside else I will work outside."
FWIW - I am very glad they chose else over otherwise...
I disagree that or is ambiguous. In English we use or to mean xor, that is one item or the other item but not both. If we want to clarify that choosing both items is an option we use the term and/or.
There are examples of inclusive “or” in natural language. When the waiter asks: “Would you like cream or sugar?”, it’s not meant to imply that you should pick only one; it’s fine to answer “both” (example from: https://divisbyzero.com/2009/09/27/is-or-an-inclusive-or-or-... ).
See also “elsewise”, equivalent to “otherwise”; use in this construct “if a, b; elsewise, c” is a good deal rarer.
I would commonly speak sentences like “I was not hungry; else would I have eaten it” among family and friends, but not typically among the general public. It definitely feels a tad archaic, or at least highfalutin.
I would not be surprised to learn that "else" is more common now thanks to programming languages.
> Christopher Strachey's CPL programming language is the grandparent of C and therefore the ancestor of most current programming languages, and he refused to use "else," calling it "ignorantly incorrect English."
Given how hard it seemed everyone who designed languages tried to avoid using the word, it would seem Strachey's view was not uncommon.
Methinks it's rather ordinary.
"A bit archaic" would be like writing "threescore years ago" -- not a normal or especially accessible way of writing, but still recognized as valid grammar.
[0] https://en.wikipedia.org/wiki/Haskell_Curry [1] http://athena.union.edu/~hemmendd/Courses/cs80/eniac-women.p...
ensure(foo), !empty()
require(bar), open()
Chinese also has a word that can transform some kinds of statements into a question. `ma` is used to form yes-no questions. Imagine if languages with truthy values required you to use an explicit keyword/character in postfix position to take a non-boolean value and use it in boolean context. if predicate:
pass
if non_predicate ma:
pass
To be clear, I'm not actually advocating for such constructs. The topic-comment form breaks down as soon as you want a predicate on multiple objects. The automatic truthy values concept is already falling out of favor in preference for explicit predicates like file_handle.is_open(). I don't actually want to program in "Cobol, but Chinese". But it is interesting to explore the space.In English, we have question and answer
Q: Where do you want to go for lunch?
A: I want to go to that pub for lunch.
In Chinese you'd say
Q: You want to go to ?? pub for lunch?
A: I want to go to that pub for lunch.
It even works for numbers, like
Q: It is ?? o'clock?
A: It is 7 o'clock.
where (C/=0)
A = B/C
elsewhere
A = 0.0
end
It blew my mind the first time I saw it. I’d never seen else in anything but an if statement before.https://stackoverflow.com/questions/9979970/why-does-python-...
Is if-then-else the electron- a deep truth waiting to be discovered- or the gasoline powered car- an option we explored for decades among others options.
For languages that don't support pattern matching or passing in functions as values, "if" is probably the best you can do with. You might be able to do something with boolean short-circuit operators but it's debatable if that that is better than the if statement.
In React, if you are using JSX, they don't have "if" statements within the markup they just use the boolean short-circuit (&&) operator.
For more ML style languages that support pattern matching, it is often easier to express solutions that way than with traditional if statements. In those situations I would say that "if" is less desirable in terms of expressive power and code readability.
Also, "if / else" only supports 2 cases, with pattern matching you can have an arbitrary amount of cases.
Without pattern matching, expressing more than 2 cases becomes a combination of nested if statements combined with "&&" and "||" expressions. This makes it much harder to read and write.
Coming from a non-pattern marching language (python) I’ve yet to see what the big deal is, maybe you can help.
I can have as many elif’s as I need cases and other than maybe not needing to repeat `x==...` I’m not sure what I’m missing out on.
With that being said, I do often wish for more elegant solutions to long winded if else
It is true that you can always just use if statements, it's more about the convenience and cleaner syntax. You can also do destructuring with pattern matching. Pattern matching is almost a requirement if you are going to use algebraic data types.
As Paul Graham says in Beating the Averages, you have to look at the other language from the perspective of knowing it. Nobody can really explain it. It's just going to seem equivalent or weird syntax otherwise.
It is such a basic, clear, and useful formalism, it is hard to imagine it not becoming widespread under some name/syntax.
But if-then-else is only clearly inevitable if you take as axiom the existence of store program computers with control flow. I can much more easily imagine that early on we invented a very different way to do computation as a whole. It seems likely that what we have actually invented is on a path toward a local optima.
Depending on the language, the syntax of "if then else" is not needed and is syntactic sugar.
In the Lambda Calculus you can implement "if else" using "first" and "second".
Here is something equivalent in JavaScript.
const trueFn = (first, second) => first
const falseFn = (first, second) => second
const ifFn = (boolFn, first, second) => boolFn(first, second)
ifFn(trueFn, 'yes', 'no') // returns 'yes'
ifFn(falseFn, 'yes', 'no') // returns 'no'let's define `delete(file)`, which returns 0 if it successfully deletes the file, and 1 if there's an error.
ifFn(trueFn, delete('A'), delete('B')) will not do what you want it to.
It's also embodied in actual machine words. The actual verbiage of "if a then b else c" is clearly less important, C elides the "then" after all.
I'm presuming you mean the construct, not the happenstance of how it's spelled out, because you're clearly referring to the electron, not the word for amber-the-stone which we happened to adopt for it.
MacCarthy writes, in History of Lisp:
I invented conditional expressions in connection with a set of chess legal move routines I wrotein FORTRAN for the IBM704 at M.I.T. during1957-58. This program did not use list processing. The IF statement provided in FORTRAN1 and FORTRAN2 was very awkward to use, and it was natural to invent a function XIF(M, N1, N2) whose value was N1 or N2 according to whether the expression M was zero or not.
Yet, no such thing was added to Lisp, initially. The 1960 Lisp 1 Programmer's Manual only lists COND.
It's not uncommon at all in mathematics to build a system with certain axioms, and then improve them later, when it's realized that simpler axioms can be used to build more complex constructs.
A Church boolean is either:
true = λt.λf.t
false = λt.λf.f
So instead of writing an expression with keywords like if bool then yep else nope
Just use the boolean as a function and apply it to the then and else clauses like bool yep nope
So the shape is very similar to modern languages, but with less syntactic scaffolding.By letting anyone free to find a better alternative. Waiting...
I started with BBC Basic II (on the Model B) which had IF..THEN but it was just one line and there was no ELSE. So if you wanted to make a 'block' you had to call a different PROC (thankfully there were PROCedures so you could avoid GOTO)
As such when I was introduced to ELSE and ENDIF with BBC BASIC V on the Archimedes it seemed like very welcome syntactic sugar - it let you do the same stuff but in a tidier way
IF A=4 THEN PRINT "FOUR" ELSE PRINT "NOT FOUR"
Statements for the IF block and the ELSE block can be separated by ':'.
I was recently given a BBC Micro and it's a fascinatingly impressive machine, the hardware and software are so beautifully designed in tandem that it's quite awesome even in 2020.
Obligatory shout out for 'Micro Men', about the making of the BBC Micro and ZX Spectrum https://www.youtube.com/watch?v=XXBxV6-zamM
As in: “Read thee the article, else thou shall suffer great ridicule in the comments.”
In your sentence above "Read" is the imperative form of the verb. The subject is elided since it's implicitly second person (singular or plural) (as imperative is used to give orders to people you're talking to) and if it wasn't elided it would have been in nominative case. Middle english had an ending -(e)th to form a plural second person imperative.
"Learn the grammar of past and present languages, else you'll attract pedants from the intertubes"
Some example syntax:
unless name is 'Steve'
print 'Impostor!'
otherwise
print 'Steve'
“if” and “else” work, too. But I really did like the “unless” and “but” keywords.> The Tenth Edition rc does not have the else keyword. Instead, if is
> optionally followed by an if not clause which is executed if the pre-
> ceding if test does not succeed.
which i found pretty interesting
if (X) { doY(); }
if not /* X is implied */ { doZ(); }
In languages like Python it could be generalized to enable one to use “if not” with an expression as usual but omit the expression if it is the last branch of a conditional, thus getting rid of the “else” keyword while maintaining or arguably improving readability.That said, there is no programming language that could entirely map to a spoken one, so perhaps it’s actually beneficial to shed any semblance of such mapping early-doors in the learning process.
A point could be made for restricting ifs to 1 or 2 clauses and delegating more complex conditions to switch/case, but that is arguably even more far out there (and in case of Python it actually doesn’t have the switch operator). Also, “if not X {…} if not {…}” would be confusing but possible.
I guess I should leave language design to the better-equipped for the time being.
if (X) { doY(); }
otherwise { doZ(); }[0]: https://en.wikipedia.org/wiki/MAD_(programming_language)
Some years later in embedded development I learned that this was actually more similar to the CPU instructions used underneath, conditional jumps.
In propositional logic, which was developed well before the first computers by Leibniz, Frege, Boole, De Morgan, etc.:
"If A then B else C" can be stated as: (A --> B) ^ (¬A --> C)
So, in patent/invention language, I'm not sure if it would really constitute an invention since it is just putting a known mathematical formalism into a programming language.
It would be possible to implement this in Leibniz' calculus ratiocinator ~300 years ago: https://link.springer.com/chapter/10.1007/978-3-319-93779-3_...
It's interesting to me that these identities and the canonical form McCarthy introduced there were exactly how BDDs work (when you just add memoizing, which was also invented about the same time) -- but BDDs weren't invented until the 1980s. (Explanation at https://codewords.recurse.com/issues/four/the-language-of-ch...)
It's easy to think things are obvious in hindsight.
When I ran the "if-else" statement of my programming language* by a user-study with my non-technical brother-in-law he said it reminded him of the binary nature of legalise and inherently limiting the nature of what is possible. I agree.
My sister also formed the study-group and consistently they both prefer "otherwise" to anything else (pardon the pun).
* The language in case anyone wants to take a look: https://github.com/ducklang-community/ducklang
https://www.youtube.com/watch?v=4A94JsWTXXwI remember over 5 years ago, they helped me me visualise 1 billion "Shazam's" (where I was working at the time) onto map tiles. Glad to see they are still supporting developers!
It has other uses, but it is that (that is, “or else” is exactly that, and, among other uses, “else” by itself is an accepted short form of “or else”.)
Apparently Cambridge Programming Language (more or less a failed language that became proto-C) designer Christopher Strachey had some misgivings about this usage of "else".
Note also that when Microsoft put IF( , , , ) into Excel, the most widely used computing application in the world, they essentially used this syntax.
About half a year in, and new language version introduced IF/ELSE statements. I was glad to finally get a semblance of modern programming, but the old RPG veterans advised against using it, since the new fancy features often didn't work so well, and anyway you can write anything you want without it.
After 14 months, my contract wasn't extended. Maybe the complaint that I could be seen sleeping at my desk sometimes were a factor.
You young kids don't know how good you have it...
...
b? addr1
...else stuff
jmp addr2
addr1:
...then stuff
addr2:
...always stuff
What's more interesting is the generalization to any boolean expression, not the naming/placement of the else/always parts.What did blow me away was seeing a function for the first time.
It's all down to comparing hex in 2 registers and jump. JNE, JE, JMP etc.
I would think Soren Kierkegaard deserves a hat-tip to his existential work: Either/Or.
There's a language where THEN basically means ENDIF... Forth, if memory serves me right?
I think the tactic strategy to achieve this is to confine conditional branches in a few well chosen words.
For instance if you have a word SORT that sorts the top pair on the stack, which has to have a branch:
: SORT 2DUP < IF SWAP THEN ;
then you can build "if-less" MIN, MAX and ABS: : MIN SORT NIP ;
: MAX SORT DROP ;
: ABS 0 SORT SWAP - ;IF you go to the store get some butter THEN come right back.
So THEN is where the program continues on a false condition. Typically Forth. It uses an alternative way of looking at things.
[0] https://gforth.org/manual/Selection.html
See also the StackOverflow thread on this topic: https://stackoverflow.com/q/12539634/
: /CHECK DUP 0= IF ." invalid " DROP ELSE / THEN ;
https://www.forth.com/starting-forth/4-conditional-if-then-s...Good work digging through these historic esoteric languages. Wikipedia states McCarthy of Lisp fame invented it so many of the evangelists here likely know the conclusion here.
Not the best of examples. It hasn’t always been. Early fortran and lisp didn’t have it. Reading https://medium.com/better-programming/a-brief-history-of-the..., it seems Algol and PL/I set the trend to make it popular.
Looking at newer languages, I also get the impression it’s on the way out. Rust has them, but python, scala, go and swift try to avoid them (https://python-reference.readthedocs.io/en/latest/docs/opera...: “Avoid having multiple statements on a single line. Though the language definition allows one to use a semi-colon to delineate statements, doing so without reason makes one’s code harder to read”, https://golang.org/doc/effective_go.html#semicolons: “Like C, Go's formal grammar uses semicolons to terminate statements, but unlike in C, those semicolons do not appear in the source. Instead the lexer uses a simple rule to insert semicolons automatically as it scans, so the input text is mostly free of them.”, https://docs.swift.org/swift-book/LanguageGuide/TheBasics.ht...: “Unlike many other languages, Swift doesn’t require you to write a semicolon (;) after each statement in your code, although you can do so if you wish. However, semicolons are required if you want to write multiple separate statements on a single line”)
if (x) then: doSomething();
if (!x) then: doOtherThing();
"Else" is a redundant construct, but it's nice to have for sure. I would prefer not writing the above code.It was great in that by default it pushed to me consider and deal with `else` in every case.
There are allot of bugs left when stopping at 'if'.
Definitely worth a look.
Or you decide to execute code on The Fungus: https://www.bedroomlan.org/hardware/fungus
I also recall reading a paper that got into implementing a GC on silicon for a graph rewriting based architecture
WebAssembly is if/else blocks. There's a potential future where it gets implemented directly as a CPU ISA (albeit it'd likely involve some dynamic translation, but the CPU may decide to have SSA as its internal representation)
It's important to understand there's a real distinction between semantics & implementation. Otherwise you risk emulating your implementation when some new hardware comes out (say GPUs, or Quantum computers, or out of order CPUs working backwards to create something like SSA for register renaming/pipelining, or cmov)
See also the debates over C code being executed in the C abstract machine for optimizers while programmers rely on implementation of the end result. But in a language without undefined / implementation-defined behavior you won't have these ways of having the program self observe its implementation
Not that, but still interesting: the Intel iAPX 432[0] was a (failed) processor from 1981 designed with high level languages in mind (specifically Ada). It supported bit-level aligned, variable length instruction, but also a built in GC and type tagging system.
Maybe this one:
BTW, it's not entirely correct that it's all if/goto. ARM has conditional execution that doesn't necessarily involve a jump, and there have been other exceptions as well.
'if x then y else z' becomes 'xy + (1-x)z', or 'x*(y-z)+z'
Jump or not jump
Jump or not jump
Jump or not jump
:out_of_range:the_end