gm2
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Design philosophy - why use a VAR for a single return value?


From: Benjamin Kowarsch
Subject: Re: Design philosophy - why use a VAR for a single return value?
Date: Tue, 26 Mar 2024 07:32:58 +0900



On Tue, 26 Mar 2024 at 04:08, Tony Wallace wrote:
I totally support this move.  As a functional programmer this makes
sense.  If a bit set operation updates variable for example, this can
be achieved with an assignment to the return value of the function.

You also "totally" ignored my response.

I used VAR parameters in the set bit and clear bit procedures. They are supposed to be destructive.
And yes, that is for efficiency, because if you use a function and then assign the result to the original operand, this would result in an additional unnecessary copy operation. If you use low-level operations like setting and clearing individual bits, there may be quite a lot of bit operations in an inner loop and then the copying will add up. And the uses cases for such operations are mostly destructive anyway.

I trust this clarifies.
benjamin 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]