Data types: object
Represents an object of any arbitrary Chora class.
Operands of this data type are intended to store references to objects of any arbitrary Chora class.
The object literal can be null only to explicitly identify 'no object'. The literal can be used within expressions wherever an object operand is expected. The type name object, in turn, is designated to be used in declarations of data members. For example:
var object theObj = null; // 'theObj' doesn't refer to any class instance. theObj = new Views::Text; // now 'theObj' refers to a new Views::Text object
Performing safe typecasts
Since an operand with the data type object can refer to any arbitrary object, it is not appropriate to directly access the members of this object. The Chora compiler is simply not able to deduce the class of the referenced object. Moreover, the actual object class can vary at the runtime dynamically.
You can, however, perform a runtime type casting operation on the object in order to determine, whether it descends from a particular class or not. In the case, the type casting succeeds, you can safely access the members of the object.
Evaluating object's ancestry
You can use the classof operator to determine the class of an object represented by an object operand.
You can compare two object operands in order to test whether these refer to the same instance or not. The following table provides an overview of the possible operations:
Equality test for two object operands.
Inequality test for two object operands.