Flexible names were introduced in section 5.5, but only one-dimensional names. What has not been made apparent in the text hitherto is that a multiple consists of two parts: a descriptor and the actual elements. The descriptor contains the lower and upper bounds of each dimension, the “stride” (that is, the number of bytes between two successive elements of the dimension in question), the address in memory of the first element of that dimension and whether the dimension is flexible. Consider the declaration
FLEX[1:0][1:3]INT flexfix
Because the mode of flexfix
is REF
FLEX[][]INT
, when it is subscripted, the mode of each element
is REF[]INT
with bounds of [1:3]
. Clearly,
after the declaration, flexfix
has no elements. In
practice, because the first (and only) dimension is flexible, there
must be some way of referring to a “ghost” element whose
descriptor (it is a one-dimensional multiple) will give its
properties. flexfix
is quite different from
FLEX[1:0]FLEX[1:3]INT flexflex
each of whose elements (when it has any) have the mode
REF
FLEX[]INT
with initial bounds
[1:3]
.
If the declaration of flexfix
is followed by the
assignment and slice
flexfix:=LOC[1:1][1:3]INT; flexfix[1]:=(1,2,3)
then it is clear that the mode of flexfix[1]
is
REF[]INT
. Note that after
flexfix:=LOC[1:4][1:3]INT
flexfix
refers to a multiple of which each element has the mode
[]INT
. However, the single dimension of
flexfix[1]
is not flexible, which is why the assignment
flexfix:=LOC[1:4][1:4]REAL #this is wrong#
will fail11.5.
Sian Mountbatten 2012-01-19