Re: Operator precedence

Liste des GroupesRevenir à cl awk 
Sujet : Re: Operator precedence
De : janis_papanagnou+ng (at) *nospam* hotmail.com (Janis Papanagnou)
Groupes : comp.lang.awk
Date : 24. May 2024, 00:53:52
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v2okuh$1vrvh$1@dont-email.me>
References : 1 2 3
User-Agent : Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0
On 23.05.2024 19:14, Axel Reichert wrote:
Kaz Kylheku <643-408-1753@kylheku.com> writes:
 
Furthermore exponentation between on an intermediate precedence level
between unary minus and regular minus is simply insane.
 
This is a very good argument! [...]

I'd be interested why you think so. Unfortunately, and opposed to
the statement, I think there was no actual "argument" presented in
this quoted sentence.[*] - Please don't get me wrong; I'm really
interested in a relatable argument, and I also try to be unbiased!

If I understand Kaz' comment correctly, the ordering of the three
operators should be different? Are you saying that the order
  unary minus
  exponentiation
  binary minus
is somehow "wrong"? - Yet, I don't see why.
Moreover, what seams reasonable (to me) is that _unary_ operators
should (typically/always?) bind tighter than _binary_ operators!
This would imply that exponentiation does not bind higher than the
unary minus. (And that the order of the upthread posted Shell and
Algol 68 expressions would thus fit better.)

Different languages also differ in their implementation choice as
shown; besides languages mentioned I read that (for example) Eiffel
implements it the way that GNU Awk has chosen. - That's now 2:2,
but counting majority is of course also no convincing argument.

OTOH, exponentiation is (typically/always?) right associative, so
it's may be somehow sensible to be handled differently compared to
the other [commutative] binary operators?

You see I'm still undecided, and still looking for explanations.
OTOH, given that this had been discussed by computer scientists
and mathematicians without clear answer, it may boil down to just
be an opinion to be decided in one way or the other.

It is interesting what the [German] Wikipedia[**] says about that.
Specifically that there's (besides exponentiation, multiplication/
division, addition/subtraction) additional categories in programming
languages; the [unary] sign that normally has a yet higher priority
than the exponentiation. - Well...

Janis

[*] "simply insane" doesn't contribute to a substantial argument.

Also the upthread mentioned "BEDMAS" sort of rule doesn't seem
to apply since unary operators are not mentioned (and there's a
difference between subtraction and negation). In our schools we
also learned such simplified rules, in our case it was "Punkt vor
Strich" (meaning multiplication and division comes before addition
and subtraction). And we had also the practice that exponentiation
has a tighter binding than a unary minus sign (as Kaz suggested).

[**] https://de.wikipedia.org/wiki/Operatorrangfolge


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