previous contents index next
(Assignments (Var.)..) Contents Index (RDL: ..)

2.11.3 The Special Status of VOID

The compounded structure of cell objects leaves us an odd little programming element: the word VOID (not to be confused with the string "VOID"), which can be used as contents of registers of all types, but only there.
But, although we do not restrict its appearance to special objects of cell type, it will only be discovered in constants and symbolic constants; it will not show up in variables or even cells within the retina or on its border. The explanation for this behaviour is very simple:
whenever two cell expressions are put in some relation to each other by an operator, all couples of corresponding registers where VOID can be found as a contents of at least one of them, are excluded from the action. (Note that = is an operator, too.) More concretely:

Now that we know this, it is evident why VOID can never appear in registers of sites or cell variables: they always get their contents by an assignment!
But what about the symbolic constants? Are there not values assigned to them, too? No. In this case, the equal sign does not function as an assign operator; it just gives the value a name! And because VOID is a constant expression, it will not be affected by the evaluation of the previous expression of the right side.


 
Example 31:


RETINA;

RANGE [0]..[10];

REGISTER INT r1;
         STRING r2;

CONST cellconst_1 = {VOID, "ready"};
      cellconst_2 = {0, VOID};

VAR STRING stringvar;
    CELL cellvar;
    BOOL boolvar;
    INT intvar;

START

   cellvar = {0, ""};
   boolvar = cellvar == cellconst_2;     /* TRUE */
   boolvar = cellconst_1 != {25, VOID};  /* FALSE */
   cellvar.r1 ++ ;
   cellvar = cellconst_1;
   boolvar = cellvar == {0, "ready"};    /* FALSE */
   cellvar = cellconst_2;
   boolvar = cellvar == {0, "ready"};    /* TRUE */


Note that VOID is neither of type INT nor of type STRING. So when the contents of a register should be interpreted as a string or an integer for further progression, it must be guaranteed first that it is not VOID. (But actually this is easy to control, for VOID can only be found written down explicitely within the source code or in symbolic constants. And, because it makes no sense to extract single values out of values which are explicitely given, we just have to make sure that there is no illegal access to symbolic constants.)


Example 32:

To continue the example above, the following assignments would have been forbidden:

stringvar = cellconst_2.r2;  /* =VOID */
intvar = abs(cellconst_1.r1) + 42; 
              /* = VOID */

previous contents index next
(Assignments (Var.)..) Contents Index (RDL: ..)