Data types: Property reference

Represents a reference to a property.

Type syntax

^data‑type

Literal syntax

null

Discussion

Operands of this data type are intended to store references to properties, allowing one object to access the property of another object without knowing each other.

A property reference data type must always be derived from another, existing data type by prefixing it with the ^ (circumflex) sign. The original data type has to match the type of properties the reference is intended to refer to. The property reference literal can be null only to explicitly identify 'no reference'. The literal can be used within expressions wherever a property reference operand is expected:

var ^string theRef = null; // 'theRef' doesn't refer to any property theRef = ^SomeTextView.String; // now 'theRef' refers to the 'String' // property of the object 'SomeTextView' if ( theRef != null ) trace "theRef contains a valid reference";

Please note, nesting of references is not allowed. In other words, you can't construct a reference to a property, which is already declared with the reference data type.

Obtaining a reference to a property

To obtain a reference to an existing property use the reference operator ^.

Accessing referenced property

To access, evaluate or modify the value of the property represented by the property reference operand use the indirection operator ^.

Comparison operations

You can compare two property reference operands in order to test whether these refer to the same property or not. The following table provides an overview of the possible operations:

Operator

Short description

==

Equality test for two property reference operands.

!=

Inequality test for two property reference operands.