It's about the poor people who read your code that relies on both you and them having perfectly memorized every single little detail of operator precedence and associativity, instead of simply and consistently using parenthesis.
Quick without looking: can you tell me what the precedence and associativity of the ternary ?: operator is?
The designer of PHP got it wrong (which isn't surprising given his proudly self proclaimed contempt towards computer science and incompetence at parser writing), but then millions of PHP programmers also learned it the wrong way.
Do you really want any of those people who were corrupted by PHP messing around with your code, if you relied on it being one way, and they assume it works the other way?
It's not that you can't tell what it actually does, it's that you can't tell what the person who wrote it actually meant, which is more important than what it actually does, especially when it has bugs.
Don't do many operations on one line, AND do use parenthesis, AND do use indentation, with no exceptions except for very simple expressions. Take every opportunity to use vertical alignment to make symmetry and repetition obvious, like:
sqrt((x * x) +
(y * y))
Redundant parens, plus breaking expressions into multiple lines and indenting according to depth, unambiguously express programmer INTENT, so the reader doesn't need to wonder if the person who wrote it had a clue or was just showboating.
Just use parenthesis, and put a comment on it, sailor.
https://www.youtube.com/watch?v=fKHaNIEa6kA
It's about the poor people who read your code that relies on both you and them having perfectly memorized every single little detail of operator precedence and associativity, instead of simply and consistently using parenthesis.
Quick without looking: can you tell me what the precedence and associativity of the ternary ?: operator is?
The designer of PHP got it wrong (which isn't surprising given his proudly self proclaimed contempt towards computer science and incompetence at parser writing), but then millions of PHP programmers also learned it the wrong way.
https://en.wikiquote.org/wiki/Rasmus_Lerdorf
Do you really want any of those people who were corrupted by PHP messing around with your code, if you relied on it being one way, and they assume it works the other way?
It's not that you can't tell what it actually does, it's that you can't tell what the person who wrote it actually meant, which is more important than what it actually does, especially when it has bugs.
Don't do many operations on one line, AND do use parenthesis, AND do use indentation, with no exceptions except for very simple expressions. Take every opportunity to use vertical alignment to make symmetry and repetition obvious, like:
Redundant parens, plus breaking expressions into multiple lines and indenting according to depth, unambiguously express programmer INTENT, so the reader doesn't need to wonder if the person who wrote it had a clue or was just showboating.Just use parenthesis, and put a comment on it, sailor.
https://wellcomecollection.org/works/m33njwx3/items
My copy of The Little Schemer won't open to page 13 because of the jelly stains.
https://vpb.smallyu.net/[Type]%20books/The%20Little%20Scheme...