Evgeny Shvarov · Oct 2

Are there auto-generated getter methods for class parameters in ObjectScript?

Hi, ObjectScript experts!

I know that there are auto-generated getter and setter methods for class properties in ObjectScript.

Are there auto-generated getter methods for class parameters?

0 91
Discussion (7)2
Log in or sign up to continue

Why would you need it?



$parameter(“”, “PARAMETER”)

This is to refer to a parameter via Embedded Python.

I’m rewriting the ObjectScript code to Embedded python and looking for the options how to deal with class parameters. Just don’t want to introduce a helper ObjectScript method to get the parameter value.

Thought it could be something autogenerated as it is for properties.


SET myinst=##class(Sample.Person).%New()
WRITE myinst.%GetParameter("EXTENTQUERYSPEC")

By default the value of the parameter is static. But you can define parameters that way that the value can be evaluated at RunTime or CompileTime

So, technically, you can define the Get method for Parameters

And generated code for those parameters

ROUTINE User.Test.G1 [Type=INT,Generated]
	;(C)InterSystems, method generator for class User.Test.  Do NOT edit.
pCOMPILETIME(%class,%parameter) public { New %classname Set %classname=%class
 Quit $ZDateTime($ZTimeStamp,,,3)
ROUTINE User.Test.1 [Type=INT,Generated]
 ;Generated for class User.Test.  Do NOT edit. 10/03/2022 07:50:07AM
ztest() public {
  Write !,"RunTime: ", ..#RUNTIME
  Write !,"CompileTime: ", ..#COMPILETIME
  hang .5
  Write !,"RunTime: ", ..#RUNTIME
  Quit 1 }
zRUNTIMEP() public {
	Quit ($ZDateTime($ZTimeStamp,,,3)) }