Application coding standards on side effects

67 views
Skip to first unread message

K.S. Bhaskar

unread,
Jun 24, 2025, 1:35:27 PMJun 24
to hard...@googlegroups.com, everyth...@googlegroups.com
Just wondering what applications do… If a caller calls abc(def), do application coding standards permit the code in abc() to have the discretion to change def, e.g., set def=$get(def)? In the most common case, it doesn't matter because calling abc() will make a private copy of the parameter. But if the caller, perhaps inadvertently on the part of the programmer, happens to call the function with an actualname, e.g., abc(.pqr),  then pqr will be changed.

Of course, this does not apply to cases where abc() is expected to change the passed parameter.

Thank you very much.

Regards
- Bhaskar

--
YottaDB - The most scalable key-value database engine in the world?
Find out for yourself.

Sam Habiel

unread,
Jun 24, 2025, 4:03:43 PMJun 24
to K.S. Bhaskar, hard...@googlegroups.com, everyth...@googlegroups.com
> do application coding standards permit the code in abc() to have the discretion to change def


The answer is yes, that usage is allowed.

--Sam

--
You received this message because you are subscribed to the Google Groups "Everything MUMPS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to everythingmum...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/everythingmumps/CAH%2BrS9dbWXAobGeOT3AjMLUrRywQ0CL2TMmhGyDzGye8N5YRRA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Coty Embry

unread,
Jun 24, 2025, 7:26:41 PMJun 24
to hard...@googlegroups.com, Bhaskar K.S., everyth...@googlegroups.com, hard...@googlegroups.com
I guess it depends on what standards you adopt. Mutation vs immutable



On Jun 24, 2025, at 3:03 PM, Sam Habiel <sam.h...@gmail.com> wrote:


--
--
http://groups.google.com/group/Hardhats
To unsubscribe, send email to Hardhats+u...@googlegroups.com

---
You received this message because you are subscribed to the Google Groups "Hardhats" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hardhats+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/hardhats/CABHT96349o5YHGp%3DFguzpr1P%3D2Qcu5Q5XzfY-k-38vxz%2BDckOw%40mail.gmail.com.

Frederick D. S. Marshall

unread,
Jun 26, 2025, 4:55:15 PMJun 26
to hard...@googlegroups.com
Dear Bhaskar,

The VA Vista (and, I suspect IHS RPMS) Standards and Conventions (SAC) do allow the called service to alter any parameter that is passed by value.

In general, in Vista and RPMS, whether a parameter may be passed by value, by reference, either, or by name for use with subscript indirection is documented in the application's official manuals and in the Vista Supported References database. If it says a param is to be passed by value, then the caller may not expect reasonable behavior if they instead pass it by reference, or vice versa.

Among other things, this means params documented as to be passed by value are available to the called service as a storage location that may be manipulated as they see fit, since a proper caller will in no way be affected by such activity. This feature of call by value is heavily exploited by services throughout Vista and RPMS.

I hope this info is helpful.

Yours truly,
Rick

Frederick D. S. Marshall
Executive Director, Vista Expertise Network
819 North 49th Street, Suite 203, Seattle, Washington 98103
rick.m...@vistaexpertise.net
+1 (206) 465-5765

--
--
http://groups.google.com/group/Hardhats
To unsubscribe, send email to Hardhats+u...@googlegroups.com

---
You received this message because you are subscribed to the Google Groups "Hardhats" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hardhats+u...@googlegroups.com.

K.S. Bhaskar

unread,
Jun 27, 2025, 11:06:29 AMJun 27
to Hardhats
Thank you very much, Rick. That answer was very helpful and spot on, especially knowing that the called service can treat that variable as a storage location. My code usually does nothing more profound with parameters passed by value than SET var=$GET(var) to make sure the parameter has a value, but I had a sudden doubt as to whether I had for years been violating some unwritten taboo.

Regards
- Bhaskar

Reply all
Reply to author
Forward
0 new messages