Information: ‘{name}’ is a ByRef formal argument and gets a copy of the argument: an assignment the callee makes to it stays there, which may be intended
This call passes a plain variable without a . to a ByRef formal argument. IRIS compiles
and runs the call, passing the variable by value, so an assignment the callee makes to it
stays in the callee. This is often meant, since ByRef also marks a formal argument that
may take an array, and an input passed by value loses nothing. Put a . before the argument
when the caller needs the callee’s result.
IRIS compiles the example.
Class Demo.ByValueToByRef
{
ClassMethod Increment(ByRef counter As %Integer)
{
Set counter = counter + 1
}
ClassMethod Call() As %Integer
{
Set counter = 0
Do ..Increment(counter) //! A6204
Quit counter
}
}