The Theory Behind Structures

While not important to your use of structures, it is interesting to note that they are based on the concepts of VTS dictionaries and metadata.

The code snippet above will create a variable named Dims whose actual value is INVALID and whose default is a locked dictionary.  The underlying structure of Dims can be visualized as follows:

dictionary_with_three_defs.gif

When Dims was instantiated as X in our example, X became a one dimensional array containing within it a pointer to Dims. This allows us to reference the contents of X using the keywords Length, Width and Height and get the correct pointers into the array X.

Because of this, it is possible to store additional data of use to the structure within the defining dictionary.  In particular, the name of the structure is stored in the dictionary’s root.  Thus:

RootValue(Cast(<struct>, 47);

...will identify an unknown structure.