ascot diagnostics

A8914

Error: Cannot reference instance member ‘{name}’ from a class method

A class method refers to a property (..Name or i%Name) or an instance method (..Method()). A class method runs without an instance, so there is no object to read the property from or to call the method on. IRIS refuses to compile the class (MPP5393 for ..Name, MPP5664 for i%Name, MPP5377 for a method). A call ##class(Cls).Method() to an instance method compiles and raises <METHOD DOES NOT EXIST> when it runs. Make the class method an instance method, or reach the member through an object (obj.Name, obj.Method()).

IRIS rejects the example.

Class Demo.AccessInstanceOnlyMemberFromClassContext Extends %RegisteredObject
{

Property Name As %String;

ClassMethod Show()
{
    Write ..Name, ! //! A8914
}

}

All diagnostics