Deutsch   English   Français   Italiano  
<878qzpuoh6.fsf@axel-reichert.de>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Axel Reichert <mail@axel-reichert.de>
Newsgroups: comp.lang.awk
Subject: Re: Operator precedence
Date: Sat, 01 Jun 2024 09:11:17 +0200
Organization: A noiseless patient Spider
Lines: 51
Message-ID: <878qzpuoh6.fsf@axel-reichert.de>
References: <v2nium$1pl8f$1@dont-email.me> <20240523092856.646@kylheku.com>
	<87sey8movv.fsf@axel-reichert.de> <v2okuh$1vrvh$1@dont-email.me>
	<87ikyvk933.fsf@axel-reichert.de> <v3crcn$29n7m$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Date: Sat, 01 Jun 2024 09:11:21 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="35e5e15d140b95874823580d92e07fbd";
	logging-data="2815240"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+h5cobek0sHWga9UP5RL+iZEuEwdih/50="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Cancel-Lock: sha1:TrBGsb5Vp0V5bnmtB68UhBTr4lM=
	sha1:0k7HPmIcXq1h+SQb3FKq5uqVRh4=
Bytes: 3571

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