VAR a: INTEGER; (* scalar *)
b: grid OF REAL; (* vector *)
c: tree OF CHAR; (* vector *)
Figure 5 Allocation of scalar and vector data
Unfortunately, this declaration semantics has some unpleasant effect for procedure arguments. Imagine, e.g. writing a function factorial, for computing the factorial value for an argument of type INTEGER. Now, a factorial function would have to be declared for scalar arguments, and for every configuration defined in a program. Since there is no way of knowing them in advance, it would be impossible to write general library routines. To remedy this situation, parameters and variable declarations inside such a procedure may use the keyword VECTOR instead of a particular configuration name. This indicates that a parameter will be used in a parallel computation, without specifying a particular configuration (this results in a generic procedure). All parameters declared as generic vectors or variables in such a procedure have to belong to the same configuration. Since no particular configuration has been specified, no data exchange may be performed in such a procedure.
PROCEDURE s_factorial(a: INTEGER): INTEGER; VAR b: INTEGER; (* scalar *) ... END s_factorial; PROCEDURE v_factorial(a: VECTOR OF INTEGER): VECTOR OF INTEGER; VAR b: VECTOR OF INTEGER; (* any vector *) ... END v_factorial;