> Yes, "a/b/c/d" is not a valid complex fraction, so an engineer should not try to interpret it this way.
To come back to the original topic, a recommendation for "when to put parentheses for code readability", I see three options:
a) have a list of people who are "allowed to interpret" and "not allowed to interpet"
b) always have a table of operator precedence at hand, or even type it in the comment next to the code
c) use parentheses at everything that could be mis-interpreted
I will definitely go for option c)
d) Give everybody a brief Lua programming introduction, where you do not assume these things are obvious
... there might be even better options, of course
> But "a÷b÷c÷d" is well defined, because division and multiplication are executed from left to right, every schoolkid knows it.
After some investigation, I have to disagree.
Apparently I'm not the only one who encountered this ambiguity.
Also (my) algebra books define commutativity, associativity, distributivity ... but never "left to right execution".
I NEVER heard of a left to right execution rule in math (only in programming), not at school, not at university.
I am not aware of any university grade algebra book (for mathematics students ... not programming books) that defines "left to right execution order".
I mean a book on fundamental algebra, not "this is correct because a scientific calculation program calculates it this way" because this would be circular reasoning.
Could you name a reference here?