🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c
Article #1361

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

#1361
From: Rosario19
Date: Sat, 07 Nov 2026 12:03
78 lines
4142 bytes
On Fri, 6 Nov 2026 12:19:53 +0000, bartc wrote:
>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

this is not ok for me

>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.
>

my point is not important the translation in cpu instrucions, it is
inportant that the code is enough compresible even 
if in a little space there are many operations. I had seen there are
use of these expressions in something example trigonometric function
as sin/cos

expression as 

"a operator1= b operator2= c"

in the meaning 

b= b operator2 c;
a= a operator1 b;

Technical Details
Message-ID: <ta4uelh3933endks2j1hv32pnaknnn69lr@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> <39erel9pi4nq3uctk7clc605evnmqm3q8i@4ax.com> <11ckgl9$2gppr$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: Sat, 07 Nov 2026 13:03:34 +0100
Organization: A noiseless patient Spider
Lines: 78
Message-ID: <ta4uelh3933endks2j1hv32pnaknnn69lr@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> <39erel9pi4nq3uctk7clc605evnmqm3q8i@4ax.com> <11ckgl9$2gppr$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 07 Nov 2026 11:55:33 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="3574365"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX18xfe5sxkExlvkccQuB3L12SKz0Tq6iQrc="; posting-host="87b645e6c8d3f333bfab3a6407bbcf15"
Cancel-Lock: sha1:ySrOwomD3WQk9AZDhuQyuuLyZ2M= sha256:Rzmz47zZtbvty0wNZOFE6GQcHqsVtk+wCpqYuyQrMIs=
	sha1:VLpJO3cQ6ujryyw6UrasOHuJq60= sha256:naVZLJRBBaViixVSQui21A62FQEJnQd5qjP9SMAU5HI=
X-Newsreader: Forte Free Agent 1.93/32.576 English (American)