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)...
| Sysop: | DaiTengu |
|---|---|
| Location: | Appleton, WI |
| Users: | 1,096 |
| Nodes: | 10 (0 / 10) |
| Uptime: | 357:14:19 |
| Calls: | 14,032 |
| Files: | 187,081 |
| D/L today: |
488 files (140M bytes) |
| Messages: | 2,478,294 |