ascot diagnostics

A6204

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

A plain variable where the parameter is ByRef: the callee gets a copy, and whatever it assigns to the parameter stays with it. IRIS compiles and runs the call. As often as not this is meant: ByRef also marks a parameter that may take an array, %Prepare’s statement text or Read’s length, and an input passed by value loses nothing. It is a mistake only when the caller reads the variable afterwards for the callee’s result; a . before the argument passes it by reference.

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
}

}

All diagnostics