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 : 30. May 2024, 09:17:04
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <87ikyvk933.fsf@axel-reichert.de>
References : 1 2 3 4
User-Agent : Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:

Are you saying that the order
  unary minus
  exponentiation
  binary minus
is somehow "wrong"?

It certainly feels like this to me. When thinking about the "why", I
could see two "arguments":

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'".

2. Mathematical programming is algorithms (often beautifully typeset
with (La)TeX) transformed into more mundane ASCII-text representations
(which I see as a technical limitation). Using different operator
precedence depending on the visual representation is certainly confusing
if not dangerous (error-prone coding). Also, I do not see the benefit of
deviating from the mathematical convention.

With the rather new trend to use UTF characters in source code (lambda
and other greek letter, arrows) the visual distinction between printed
math and written source gets smaller, so it makes less and less sense to
use different conventions for the two.

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