ARGTYP_READONLY

.ARGTYP() refinement: a new flag, ARGTYP_READONLY (&h0200) will be set if the passed argument is a literal value, expression, or otherwise incapable of receiving an updated value. This provides a good way for routines to be able to decide whether it is worth generating and returning values for output parameters. For example:

Function Fn'Foo(arg1=0 as b2, arg2="" as s0, arg3=-1 as f6)

    ...

    ! calc and return arg3 if not readonly

    if NOT .ARGTYP(3) and ARGTYP_READONLY then

        <calculate updated arg3 value>

        .xputarg @arg3

    endif

    ...

Notes: The new flag is set by the runtime system (beginning in A-Shell 6.4.1553.0) and is independent of the compiler version. Prior versions of the runtime will never set the ARGTYP_READONLY flag and thus logic like that above would would always calculate and output the parameter when running on earlier runtime versions (i.e. dependability over optimization). In the above example, the use of default values will guarantee that the function receives three parameters, but in general, you may want to use the .ARGCNT dot variable, and/or check for special default values, to avoid wasting time, however harmlessly, generating return values for parameters that were not passed.