🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c
Article #1353

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

#1353
From: bartc
Date: Fri, 06 Nov 2026 12:19
59 lines
3630 bytes
On 06/11/2026 11:29, Rosario19 wrote:
> 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

Actually, in Algol68, only 'number' changes, because it is parsed like this:

    (number *:= base) +:= digit

But JP doesn't think it is confusing, so that's alright.


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

Both do the same thing; my point here was that using simpler language 
constructs, as well as being less ambiguous, can be also be implemented 
more efficiently within interpreters or with any non-optimising tools.

Technical Details
Message-ID: <11ckgl9$2gppr$1@dont-email.me>
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> <39erel9pi4nq3uctk7clc605evnmqm3q8i@4ax.com>

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: bartc <bc@freeuk.com>
Newsgroups: comp.lang.c
Subject: Re: Rationales for result type of operations using operators like
 '+='
Date: Fri, 6 Nov 2026 12:19:53 +0000
Organization: A noiseless patient Spider
Lines: 59
Message-ID: <11ckgl9$2gppr$1@dont-email.me>
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>
 <39erel9pi4nq3uctk7clc605evnmqm3q8i@4ax.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 06 Nov 2026 12:19:54 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="2647867"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX18uJrOkstBTAzWPth50xPXR"; posting-host="06e92dab06e7bbad2d3f6c6728786274"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:9M2YiYDXBX8IzPtyig7emIwamX4= sha256:3uYAol6IxbSkwJVpG8FIZOJeN0wm3iT7cTMCY3ftvsc=
	sha1:IME7s2YgFkzj2oOd1mNhb/1uaG8= sha256:XzVkPuhHgmhLC4vj5JlOLs57PGtRNkJA4nTg+21berU=
Content-Language: en-GB
In-Reply-To: <39erel9pi4nq3uctk7clc605evnmqm3q8i@4ax.com>