[net.lang.mod2] open array parameters only 1d

cca@pur-phy.UUCP (Charles C. Allen) (10/17/84)

I just realized that open array parameters can only be one dimensional (a
thick skull, I guess).  In a matrix module, for instance, I'd like to be
able to say:

	PROCEDURE MatMult(    A, B : ARRAY OF ARRAY OF REAL;
			  VAR C    : ARRAY OF ARRAY OF REAL) ;

It's possible to achieve the results by using ARRAY OF WORD parameters, but
then all sorts of other info must somehow get passed in (size of array
objects, size of each dimension).  Either the number of parameters balloons,
or the matrix must be imbedded in a record structure which contains
(redundant) information about the size of the dimensions.  Ick.

Allowing the above type of parameter declaration and extending HIGH to take
a second parameter indicating what dimension you want the size of would be a
clean way of achieving the desired result.  HIGH(A,2) would give the size of
the second dimension of A.  Of course, now HIGH would be a pseudo-function
if HIGH(A) is still to be allowed for one-dimensional open array parameters.

Any other ideas?  Am I being incredibly dense and missing something that
allows this to be done with the standard definition?

Growf.  It's things like this that make Ada look better.

Charlie Allen
UUCP:		pur-ee!Physics:cca, purdue!Physics:cca
INTERNET:	cca @ pur-phy.UUCP