Value types behave much like the primitive types, in that they are allocated on the stack and deallocated when the variable goes out of scope. Only the application can register these types, so you need to check with the application's documentation for more information about the registered types.
Reference types are allocated on the memory heap, and may outlive the initial variable that allocates them if another reference to the instance is kept. All script declared classes are reference types. Interfaces are a special form of reference types, that cannot be instanciated, but can be used to access the objects that implement the interfaces without knowing exactly what type of object it is.
obj o; // An object is instanciated o = obj(); // A temporary instance is created whose // value is assigned to the variable
null
.
obj o; obj@ a; // a is initialized to null obj@ b = @o; // b holds a reference to o
b.ModifyMe(); // The method modifies the original object
if( a is null ) // Verify if the object points to an object { @a = @b; // Make a hold a reference to the same object as b }
Not all types allow a handle to be taken. Neither of the primitive types can have handles, and there may exist some object types that do not allow handles. Which objects allow handles or not, are up to the application that registers them.
Object handle and array type modifiers can be combined to form handles to arrays, or arrays of handles, etc.