[comp.lang.ada] Renaming in a generic package

barnes@castor.cs.nps.navy.mil (patrick barnes) (11/30/90)

We have the following generic package declaration ( in an Ada class
project ).
-------------------------------------------------------------------------------
generic
  N : POSITIVE;
package MATRIX_STUFF is
  type MATRIX is array(1 .. N, 1 .. N) of INTEGER;
  function MULT(X, Y : MATRIX) return MATRIX;
  function "*" (X, Y : MATRIX) return MATRIX renames MULT;
  -- rename it so the body can be compile as an "is separate" subunit
  procedure PUT(SQUARE : in MATRIX);
end MATRIX_STUFF;

--When we instantiate the generic with a size, 5 for example, then try
to use the "*" operator, we get a run-time constraint error on the
array bounds. 
--We can easily solve the problem by moving the renames clause to the
declarative part where the generic is instantiated.  The question is
why doesn't Ada know the size of the matrix of "*" when MATRIX_STUFF
is instantiated?

Pat

-- 
	Capt Patrick D. Barnes, USAF  	barnes@cs.nps.navy.mil
	NPGSCOL/Code CS/Ba		(408) 646-2830
	Monterey, CA  93943		FAX (408) 646-2814