6 ms·
Not really because the ordering is unambiguous given the parens. No need for operator precedence rules like PEMDAS.
by rileyphone 2y ago
Not really because the ordering is unambiguous given the parens. No need for operator precedence rules like PEMDAS.
- munificent 2y agoOh, you still have to worry about precedence. Consider: var x = 123 print(-x.abs()) Or even: print(-123.abs()) What do those print? Do they print the same thing?
- rileyphone 2y agoUnary operators are still operators. The integer parsing rules are probably different. In Lisp, -x would be a symbol, and the proper analog to -123 would be (- x) eg.
- munificent 2y agoI think we're in agreement. `-` and `.` are both operators and the language and user have to understand the relative precedence of them.