Contains the current class context.
contains the current class context. The class context for an instance method is the current object reference (OREF). The class context for a class method is the current classname as a string value. For example, if you issue the command DO ..method()
or SET ..property = value
from within a class method, the .. context is resolved using the current value of $THIS
. When making a reference within an object instance, the relative dot syntax (..) is preferred.
is commonly used when you are within an object instance and you call a function that is on another object. In this circumstance, you can use $THIS
to pass the current class context to that function, so that it can return a value to your current object instance.
does not contain a valid object reference, Caché returns a <NO CURRENT OBJECT> error.
can be used in the contexts such as the following:
SET x = ##class(otherclassname).method($THIS)
This special variable cannot be set to a value using the SET
command. Attempting to do so results in a <FUNCTION> error.