Subsections

- Exercises

# Dynamic names

Hitherto, all the names which can refer to rows were declared with bounds whose values were given by integer denotations. In fact, the bounds given on the right-hand side of the identity declaration can be any unit which yields an integer in a meek context. So it is quite reasonable to write

       REF INT size = LOC INT;  read(size);
       REF[]INT a = LOC[1:size]INT

or even

       REF[]INT r=
          LOC[1:(REF INT i=LOC INT;
                 read(i);
                 i)]INT

since an enclosed serial clause has the value of its last unit. The value of the clause in the parentheses is a name of mode `REF INT` and since the context of the clause is meek, dereferencing is allowed. The context is passed on to the last unit in the clause. Thus the integer read by `read` will be passed to the generator.

A dynamic name is one which can refer to a multiple whose bounds are determined at the time the program is elaborated. It means that you can declare names referring to multiples of the size you actually require, rather than the maximum size that you might ever need.

## Exercises

5.15
  Declare a name which can refer to a multiple of reals whose upper bound is determined by reading an integer from the keyoard. Ans
5.16
  Write a program which will read an integer which says how many integers follow it. Compute the sum of all the integers and print it. Ans