Extrinsic Special Variables

An extrinsic special variable is a user-written M subroutine that another M routine can invoke to return a value.

The format for extrinsic special variables is:

$$[label][^routinename]

An extrinsic special variable can be thought of as an extrinsic function without input parameters. $$x is equivalent in operation to $$x(). Extrinsic special variables are the only case where invocation of a formallabel does not require an actuallist. M stacks $TEST for extrinsic special variables.

M requires that a routine that implements an extrinsic special variable terminate with an explicit QUIT command which has an argument. M returns the value of the QUIT command argument as the value of the extrinsic special variable.

Example:

GTM>ZPRINT ^DAYOWEEK
DAYOWEEK();extrinsic special variable to
;provide the day of the week
QUIT $ZD($H,"DAY")
GTM>WRITE $$DAYOWEEK^DAYOWEEK
MON