Re: Operator precedence

Liste des GroupesRevenir à cl awk 
Sujet : Re: Operator precedence
De : mail (at) *nospam* axel-reichert.de (Axel Reichert)
Groupes : comp.lang.awk
Date : 01. Jun 2024, 08:11:17
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <878qzpuoh6.fsf@axel-reichert.de>
References : 1 2 3 4 5 6
User-Agent : Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:

On 30.05.2024 10:17, Axel Reichert wrote:
1. Unary and binary minus, while not identical operators, at least
visually are identical. Hence it reduces the cognitive load on the
reader of source code, who does not need to remember that unary minus
and binary minus are "on opposite sides of the 'exponentiation fence'".
>
I sort this "argument" (quotes borrowed from your text) into the same
category as "[old] mathematical convention". IMO it doesn't withstand
the slightest analysis. To explain I'm going back to "Computer Science
101" as taught in the 1980's (and probably even before)...
You model expressions with Kantorovic trees (using a homonym '-' here)
  a     b    c
   \   /     |
    '-'     '-'
but what I depicted are different operations, as can obviously be seen.
Their evaluation in a stack automaton will happen like
  push(a); push(b); subtract()  and  push(c); negate()  respectively.
If there wouldn't be a distinction and we had, say, a single 'minus()'
operation there'd be no indication to reduce that part of expression.

How does the low-level computational model of a stack automaton
invalidate my claim about the reduced cognitive load? When reading
source code (in an supposedly infix language), I certainly think neither
about Kantorovic trees nor about an Forth-like (RPN) evaluation model.

Deviation from conventions makes sense when appropriate.

Sure. If you can agree with the summary that the disagreement is about
"conventions copied from the domain modelled, in this case maths (awk,
...) versus consistency (Algol, ksh)", than we can end this (very
interesting!) discussion.

By the way, of the latter (consistency), I am a big fan, hence some
programming language's syntax excessions drive me crazy: "Was it
'foo(bar)' or 'bar.foo()' or 'foo bar'?" Which is why I have a weak spot
for Lisps and Forth/Factor. No more earmarks in books with operator
tables.  (-:

I'm glad that the "Burning Witches" convention has been superseded,
and that "Newton" got fixed by Relativity and Quantum Mechanics. :-)

I know what you mean, but rest asured that Newton has NEITHER been
wronged NOR superseded in the domain relevant to daily life. I would
have used the wording "extended" rather than "fixed", but can live with
your choice.   (-:

Thanks and best regards!

Axel

Date Sujet#  Auteur
23 May 24 * Operator precedence27Janis Papanagnou
23 May 24 `* Re: Operator precedence26Kaz Kylheku
23 May 24  `* Re: Operator precedence25Axel Reichert
24 May 24   +* Re: Operator precedence21Janis Papanagnou
24 May 24   i+* Re: Operator precedence17Janis Papanagnou
24 May 24   ii`* Re: Operator precedence16Kaz Kylheku
25 May 24   ii +* Re: Operator precedence13Axel Reichert
25 May 24   ii i`* Re: Operator precedence12Janis Papanagnou
26 May 24   ii i `* Re: Operator precedence11Janis Papanagnou
26 May 24   ii i  +* Re: Operator precedence4Kaz Kylheku
30 May 24   ii i  i`* Re: Operator precedence3Janis Papanagnou
30 May 24   ii i  i `* Re: Operator precedence2Axel Reichert
31 May 24   ii i  i  `- Re: Operator precedence1Janis Papanagnou
26 May 24   ii i  +* Re: Operator precedence4Christian Weisgerber
26 May 24   ii i  i+* Re: Operator precedence2Kaz Kylheku
30 May 24   ii i  ii`- Re: Operator precedence1Janis Papanagnou
30 May 24   ii i  i`- Re: Operator precedence1Janis Papanagnou
30 May 24   ii i  `* Re: Operator precedence2Axel Reichert
31 May 24   ii i   `- Re: Operator precedence1Janis Papanagnou
25 May 24   ii `* Re: Operator precedence2Janis Papanagnou
26 May 24   ii  `- Re: Operator precedence1Kaz Kylheku
30 May 24   i`* Re: Operator precedence3Axel Reichert
31 May 24   i `* Re: Operator precedence2Janis Papanagnou
1 Jun 24   i  `- Re: Operator precedence1Axel Reichert
24 May 24   `* Re: Operator precedence3Kaz Kylheku
25 May 24    `* Re: Operator precedence2Axel Reichert
26 May 24     `- Re: Operator precedence1Kaz Kylheku

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal