Extended References
In InterSystems IRIS® data platform, all code that runs on the server runs in a namespace; see Namespaces and Databases. ObjectScript supports extended references, which is syntax that enables you to refer to specific kinds of items in other namespaces.
Introduction
An extended reference is a reference to an entity that is located in another namespace. The namespace name can be specified as a string literal enclosed in quotes, as a variable that resolves to a namespace name, as an implied namespace name, or as a null string ("") a placeholder that specifies the current namespace.
All extended references can specify the current namespace, either explicitly by name, or by specifying a null string placeholder.
Types
There are three types of extended references:
-
An extended global reference references a global variable in another namespace. The following syntactic forms are supported:
^["namespace"]global ^|"namespace"|global
For further details, see Extended Global References.
-
An extended routine reference references a routine in another namespace.
-
The DO command, the $TEXT function, and user-defined functions support the following syntactic form:
|"namespace"|routine
-
The JOB command supports the following syntactic forms: :
routine|"namespace"| routine["namespace"] routine:"namespace"
In all these cases, the reference is prefaced by a ^ (caret) character to indicate that the specified entity is a routine (rather than a label or an offset). This caret is not part of the routine name. For example, DO ^|"SAMPLES"|fibonacci invokes the routine named fibonacci, which is located in the SAMPLES namespace. The command WRITE $$fun^|"SAMPLES"|house invokes the user-defined function fun() in the routine house, located in the SAMPLES namespace.
-
-
An extended SSVN reference references a structured system variable (SSVN) in another namespace. The following syntactic forms are supported:
^$["namespace"]ssvn ^$|"namespace"|ssvn
For further details, refer to the ^$GLOBAL, ^$LOCK, and ^$ROUTINE structured system variables.