Deutsch English Français Italiano |
<v2okuh$1vrvh$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!feeds.phibee-telecom.net!2.eu.feeder.erje.net!feeder.erje.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Janis Papanagnou <janis_papanagnou+ng@hotmail.com> Newsgroups: comp.lang.awk Subject: Re: Operator precedence Date: Fri, 24 May 2024 01:53:52 +0200 Organization: A noiseless patient Spider Lines: 59 Message-ID: <v2okuh$1vrvh$1@dont-email.me> References: <v2nium$1pl8f$1@dont-email.me> <20240523092856.646@kylheku.com> <87sey8movv.fsf@axel-reichert.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Injection-Date: Fri, 24 May 2024 01:53:54 +0200 (CEST) Injection-Info: dont-email.me; posting-host="286141994a7da1ba38b53d9c72cb798c"; logging-data="2093041"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+c1766L/Z+lxqUPtDy4UfH" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 Cancel-Lock: sha1:UydmnDKPUJTOhmUa/CVt9mI0yGo= X-Enigmail-Draft-Status: N1110 In-Reply-To: <87sey8movv.fsf@axel-reichert.de> Bytes: 3863 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