3 ms·
> No arithmetic precedence. Interesting. I've wondered about this when making an expression parser. Obviously it makes parsing way easier and mistaken preceden
by IshKebab 3y ago
> No arithmetic precedence.
Interesting. I've wondered about this when making an expression parser. Obviously it makes parsing way easier and mistaken precedence is often a cause of bugs (especially in C where some of the operator precedence is plain wrong). But on the other hand that's got to be quite annoying surely?
- int_19h 3y agoIt really depends on how you implement it. I don't think that requiring parentheses in something like a+b*c is annoying, but if they also prohibit a+b+c, that's a different story.
- zetalyrae 3y agoIn my experience you don't use nested arithmetic often enough to make it annoying. Most arithmetic in computing is basically `count := count + 1`? What is more annoying to me is looking at an expression that mixes arithmetic and logical/comparison operators and mentally trying to recover the parentheses. Because precedence is not just PEMDAS: it involves all binary operators in the language, including logical and bitwise ones.
- crabmusket 3y agoDon't forget ternaries and null-checking operators too. `x ? y : z ?? "oh boy"`
- solomatov 3y agoSmalltalk has this "feature" and was doing fine. It was pretty popular at some point.