Question
· Sep 16, 2022

Passing object to a function in objectscript

Let's consider these two ways of passing an obj to a function:

//var is a structured obj
(1) do ..methodX(var)
(2) do ..methodX(.var)

In c++ if we pass an obj by reference like in (2) we save a lot in computation because we are not copying the whole object, and when the object is modified within the function it is modified also for everyone.

In this case does (2) achieve any better performance than (1)? Is passing with the "." save any computation? the object is copied anyway?

Is there a simple way of passing obj to a function?

Product version: IRIS 2021.2
$ZV: InterSystems Studio Client 2021.1.2 Build 338 Server IRIS for UNIX (Red Hat Enterprise Linux for x86-64) 2021.1.2 (Build 336U)
Discussion (3)2
Log in or sign up to continue