3 ms·
Now, let's imagine an APL-like language with precedence: APL has a huge number of operators and worse, you can and will define your own, as the classic distinc
by cardanome 4y ago
Now, let's imagine an APL-like language with precedence:
APL has a huge number of operators and worse, you can and will define your own, as the classic distinction between operators and functions does not apply to APL. So a huge precedence table to memorize! Plus, with user defined operators you would either have to force them to be all the same precedence, which is kind of a bummer, or you allow them to define their own precedence. It should be obvious that this would be a huge mess.
So actually no having precedence is the most sane way forward but you also gain something: Order of precedence errors are quite common both in mathematics and programming. Doing away with precedence rules gets rid of a whole class of errors. Awesome! (If you are going to respond that you never make any errors, well congrats on being smart, I am not. I try to avoid relying on lesser known precedence rules in my code as best as I can.)
So what do we gain from precedence rules again? Shorter and less noisy? Ugh, have you seen APL? I think they are good.
The notation of APL is explicitly designed to be human friendly. Lot's of thought was put into it. I recommend reading this Iverson paper: http://www.sigapl.org/Articles/Notation%20as%20a%20Tool%20of%20Thought_a1979-iverson.pdf http://www.sigapl.org/Articles/Notation%20as%20a%20Tool%20of...