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: Alice Osako
Subject: Re: Design philosophy - why use a VAR for a single return value?
Date: Fri, 22 Mar 2024 19:20:33 -0400
User-agent: Mozilla Thunderbird


Benjamin Kowarsch:
On Sat, 23 Mar 2024 at 07:51, Alice Osako <alicetrillianosako@gmail.com> wrote:
I am changing the API for CardBitOps to eliminate all VAR parameters for any case where only a single value is returned.

I am baffled as to why the original design used them in the first place, and dealing with that bad design decision was driving me up the wall.

In a parameter list, VAR is for passing by reference.

Well, yes, obviously.

Unfortunately, neither PIM nor ISO provide pass by immutable reference.

We fixed this flaw in M2R10 by adding CONST for passing by immutable reference.

I see the point of this, sure, but I don't see how it is relevant in this instance.

The reason why you may want to use VAR is efficiency, since passing a pointer is faster than copying a larger data structure.

I understand that, yes. However, in this case all of the parameters were CARDINALs. That argument doesn't hold water for those.



reply via email to

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