Language enhancement, compiler edit 825: XPUTARG now supports the ability to reference the parameter to be returned by its name rather than by its number, using the following syntax:
XPUTARG @arg {=<expr>}
where arg must be one of the arguments in the function's (or procedure's) formal parameter list. When identifying the parameter this way, <expr> becomes optional, defaulting to the parameter's current value.
Identifying the parameters by their names has two advantages over using the parameter numbers: 1) it makes for more self-documenting code, and 2) it eliminates the need to adjust the XPUTARG statements if you add, delete, or rearrange the function parameters, thus eliminating a source of bugs.
For example:
function fn'foo(arg1 as f6, arg2 as b4) as i2
...
xputarg @arg1 ! new: same as xputarg 1, arg1
xputarg @arg2=arg1*7 ! new: same as xputarg 2, arg1*7
xputarg arg2,arg1*7 ! old: value of arg2 is arg # to return
xputarg 2, -1 ! old: return -1 for 2nd arg
endfunction
Note the difference between the second and third XPUTARG statements above (with and without the '@'). In the former, we pass the value arg1*7 back for the argument whose name is arg2 (the second argument). In the latter, we evaluate arg2 and use that as the argument number to pass the arg1*7 value back to.