Data types: any

Represents any of the datatypes.

Type syntax

any

Discussion

The type name any is used exclusively in declarations of data members intended to store references to properties of any arbitrary data type. As such any appears always in combination with the prefix reference operator ^. For example:

var ^any theRef = null; theRef = ^SomeRectProperty; // 'theRef' refers a 'rect' property theRef = ^SomeStringProperty; // now, 'theRef' refers a 'string' property

Since an operand with the data type ^any can store any arbitrary property reference, it is not appropriate to apply the indirection operations on it. The Chora compiler is not able to deduce the data type of the referenced property. Moreover, the actual type can vary at the runtime dynamically. As such, the referenced properties can be neither evaluated nor modified.

Data members declared with ^any as type are thus used only in conjunction with the statements attachobserver, detachobserver and notiyfobservers to register observers and broadcast notifications. For example:

var ^any theRef = ^SomeRectProperty; [...] // Attach the 'onUpdateData' slot method as observer to the property // referenced by 'theRef' attachobserver onUpdateData, theRef; [...] // Notify all observers attached to the property referenced by 'theRef' notifyobservers theRef;