🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c
Article #1349

Re: Rationales for result type of operations using operators like '+='

#1349
From: Rosario19
Date: Fri, 06 Nov 2026 11:29
46 lines
3056 bytes
On Fri, 6 Nov 2026 00:27:15 +0000, bartc wrote:
>On 05/11/2026 22:41, Janis Papanagnou wrote:
>> On 2026-11-05 13:17, bartc wrote:
>
>> We still have the advantages that I mentioned elsethread. But that
>> was not my question.
>> 
>> I remind: since they have introduced op= to return a value why did
>> they do it the way they did. Specifically, what are the use-cases
>> that they support by their implementation semantics (with rvalues
>> and right-associativity).
>
>Algol68 had this big idea that everything has to return some value, 
>including compound assignment. Given that, it made these choices, which 
>includes ordinary assignment having RTL precedence, and compound 
>assignment being LTR.
>
>Personally I don't see any great need to allow compound assignments to 
>be chained at all, as it only leads to harder-to-understand code with 
>too many things being updated within the same statement.
>
>So my compound assignments return 'void'.
>
>
>>> But doing it with ordinary assignment has some advantages:
>>>
>>> * Only one assignment is done, not 4 lots of /compound/ assignments.
>> 
>> This appears to me to be nonsensical given that we are talking about
>> abstractions in a higher-level language, and that the transformation
>> to machine instructions need not even result in different code.
>> 
>>>    With a poor implementation, that will be less efficient
>> 
>> With poor implementation everything will be less efficient.
>
> >    number *:= base +:= digit

this would change base and number... for me would be ok

>I did a brief speed test using A68G. That version was 50% slower than:
>
>     number := number * base + digit;

this would change only number
Technical Details
Message-ID: <39erel9pi4nq3uctk7clc605evnmqm3q8i@4ax.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
References: <11ceoa2$85p3$3@dont-email.me> <11chs5e$1jlqr$1@dont-email.me> <11cj0n7$85p3$8@dont-email.me> <11cj6t3$242aq$1@dont-email.me>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: Rosario19 <Ros@invalid.invalid>
Newsgroups: comp.lang.c
Subject: Re: Rationales for result type of operations using operators like '+='
Date: Fri, 06 Nov 2026 12:29:54 +0100
Organization: A noiseless patient Spider
Lines: 46
Message-ID: <39erel9pi4nq3uctk7clc605evnmqm3q8i@4ax.com>
References: <11ceoa2$85p3$3@dont-email.me> <11chs5e$1jlqr$1@dont-email.me> <11cj0n7$85p3$8@dont-email.me> <11cj6t3$242aq$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 06 Nov 2026 11:21:54 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="2605668"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19aiYMIv1avSRRNvpO+05ZphkKJibytIK8="; posting-host="a60ec318c09e5b2e21171f455402efc2"
Cancel-Lock: sha1:+/YjgTzjKJT7Jg3VaW9Gkm0dq6I= sha256:NMqFUu2ZL5pPvt/VzxBWL7ihkfAJdwD4LdY3+2sctgU=
	sha1:VrpfA65fwxOsPqzP3OJqXULOKpw= sha256:Ib2R0lLW6mYv4mzGqUbN/jfHUjI23XDfKlyH5Hr+ylE=
X-Newsreader: Forte Free Agent 1.93/32.576 English (American)