PSA: POSIX shells (bash etc) do the same thing for && and ||. `true || false && false; echo $?` will be 1, not 0, because it evaluates `true || false -> true; true && false -> false`, not `false && false -> false; true || false -> true`. Don't assume like I once did that they have precedence like they have in C etc :D
This approach is, arguably, more readable because it relies on a simple left-to-right evaluation. Programmers don't have to recall the complex, though often familiar, rules of operator precedence.
It’s definitely easier to parse, but you can use shunting yard to do operator precedence parsing using very little extra memory and no recursion. I feel like the language is just poorly designed.
I implemented the same in some of my programming languages. If you look into very generic mixfix operators in some languages like Agda, you'll realize that operator precedence is a mess and it feels so much better to get rid of it. Of course, it makes the language unusable as a mainstream language, but it makes so much more logical sense.
The explanation that makes most sense to me is that it's mostly to avoid having to explicitly write out parentheses a lot of the time. Especially for things like polynomials, which are a bunch of multiplied terms added together, eg 3x+2y and not (3*x)+(2*y). And in polynomials you can even drop the explicit multiplication symbol, so it's much neater. And once you've done this for algebra now you have to do it for plain arithmetic as well to make it all match up, and 3*5+2*7 gives the same answer as evaluating the polynomial at 5,7
Not just simplicity-the original implementation was for a very resource-constrained 1960s minicomputer, where a more complex implementation would have slowed the system down even more and left less memory for running the actual business application
Arnavion|8 months ago
valleyer|8 months ago
chrchr|8 months ago
thomascountz|8 months ago
tuveson|8 months ago
gnulinux|8 months ago
koakuma-chan|8 months ago
roywiggins|8 months ago
magicalhippo|8 months ago
jorkingit|8 months ago
Jtsummers|8 months ago
tbrownaw|8 months ago
skissane|8 months ago
randomNumber7|8 months ago
UltraSane|8 months ago