Ask an Ada expert what is the value of ## # #This brings us to a coding style rule that I wish everyone would follow. # #Use parentheses unless the order of evaluaton is VERY OBVIOUS. A person # #reading your code should _never_ have to go to the RM to look up the # #precedence of operators, and certainly you should never refer to that # #section when writing code; use parentheses instead. #
-5 mod 3 # Almost anyone [gets it wrong] ... the default # parenthesiztion of this expression is -(5 mod 3). #
John J Herro wrote in 1996:
#This brings us to a coding style rule that I wish everyone would
#follow. Use parentheses unless the order of evaluaton is VERY
#OBVIOUS. A person reading your code should _never_ have to go to
#the RM to look up the precedence of operators, and certainly you
#should never refer to that # section when writing code; use
#parentheses instead.
#This brings us to a coding style rule that I wish everyone would
#follow. Use parentheses unless the order of evaluaton is VERY
#OBVIOUS. A person reading your code should _never_ have to go to
#the RM to look up the precedence of operators, and certainly you
#should never refer to that # section when writing code; use
#parentheses instead.
I wonder why we bother to have operator precedence rules, then? Give
all operators the same precedence, and make the grouping parentheses >mandatory.
On Wed, 7 Jan 2026 20:27:12 -0000 (UTC), Lawrence D’Oliveiro wrote:
On Wed, 7 Jan 2026 13:01:53 +0100, Nioclás Pól Caileán de
Ghloucester wrote:
John J Herro wrote in 1996:
#This brings us to a coding style rule that I wish everyone would
#follow. Use parentheses unless the order of evaluaton is VERY
#OBVIOUS. A person reading your code should _never_ have to go to
#the RM to look up the precedence of operators, and certainly you
#should never refer to that # section when writing code; use
#parentheses instead.
I wonder why we bother to have operator precedence rules, then?
Give all operators the same precedence, and make the grouping
parentheses mandatory.
+1
So instead of
2 + (3 × 5)
or
(2 + 3) × 5
you could have
(+ 2 (× 3 5))
or
(× (+ 2 3) 5)
respectively. Bye-bye precedence issues!
On Wed, 7 Jan 2026 20:27:12 -0000 (UTC), Lawrence D’Oliveiro wrote:
So instead of
2 + (3 × 5)
or
(2 + 3) × 5
you could have
(+ 2 (× 3 5))
or
(× (+ 2 3) 5)
respectively. Bye-bye precedence issues!
Brings back fond memories of the HP calculators with RPN ...
On Sun, 11 Jan 2026 18:29:13 -0000 (UTC), Dirk Craeynest wrote:
Brings back fond memories of the HP calculators with RPN ...
What I posted is 'PN' -- 'RPN' without the 'R'.
Brings back fond memories of the HP calculators with RPN (Reverse Polish Notation)...
... experience shows that developers are often loath to insert what
they consider to be redundant parenthesis (because “Everybody knows
what the precedence is ...
On Fri, 13 Feb 2026 12:22:03 -0000 (UTC), Nioclás Pól Caileán de Ghloucester wrote:
... experience shows that developers are often loath to insert what
they consider to be redundant parenthesis (because “Everybody knows
what the precedence is ...
Or because, you know, if in doubt they can refer to the documentation,
which they always keep handy, right?
| Sysop: | DaiTengu |
|---|---|
| Location: | Appleton, WI |
| Users: | 1,099 |
| Nodes: | 10 (0 / 10) |
| Uptime: | 492375:36:23 |
| Calls: | 14,106 |
| Calls today: | 2 |
| Files: | 187,124 |
| D/L today: |
1,809 files (807M bytes) |
| Messages: | 2,496,079 |