2 ms·
> No operator precedence rule is inherently sensible regardless of the context within which you are attempting to figure out how operator precedence works: It i
by SAI_Peregrinus 7y ago
> No operator precedence rule is inherently sensible regardless of the context within which you are attempting to figure out how operator precedence works: It is an intractable problem.
I disagree. FORTH got it right. Postfix notation is inherently sensible, as any RPN calculator user will tell you. It eliminates the need for both precedence rules and parentheses, unambiguously.
1 2 + 3 * is 9. 1 2 3 * + is 7.
It's infix notation that's the problem, precedence confusion is a consequence of it. (Prefix notation can work too, but requires more parentheses).
- rzwitserloot 7y agoAvoiding precedence issues is great. Absolutely. However, it's not crazy to want to write it like most humans are used to. I have no problem with the idea that it's more trouble than it sounds like, and '1 2 +' is the best answer to the dilemma. That still doesn't make it a slam dunk. Or should we start saying that just about every programming language out there has a major design flaw, in that it has infix and not postfix operators?