From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,59527e4d6c089fb8,start X-Google-Attributes: gid103376,public From: nobody@REPLAY.COM (Anonymous) Subject: What am I missing here? Date: 1997/11/18 Message-ID: <199711182150.WAA17925@basement.replay.com>#1/1 X-Deja-AN: 290550496 Organization: Replay and Company UnLimited Mail-To-News-Contact: postmaster@nym.alias.net X-001: Replay may or may not approve of the content of this posting X-002: Report misuse of this automated service to X-URL: http://www.replay.com/remailer/ Newsgroups: comp.lang.ada Date: 1997-11-18T00:00:00+00:00 List-Id: The following code has a compilation error (distilled from a much larger real-world system): generic type Real is digits <>; -- private; type Index is range <>; type Vector is array (Index range <>) of Real; type Matrix is array (Index range <>, Index range <>) of Real; package Fun_Matrix is function Row (M : Matrix; I : Index) return Vector; procedure Set_Row (M : out Matrix; I : in Index; To : in Vector); -- -------------------------------------------------------------------- -- "&": -- Concatenates two matrices into upper left and lower right -- corners -- of the returned matrix. -- function "&" (M1, M2 : Matrix) return Matrix; end Fun_Matrix; package body Fun_Matrix is function Row (M : Matrix; I : Index) return Vector is V : Vector (M'range(2)); begin for J in V'range loop V(J) := M(I,J); end loop; return V; end Row; procedure Set_Row (M : out Matrix; I : in Index; To : in Vector) is begin for J in To'range loop M(I,M'first(2) + J - To'first) := To(J); end loop; end Set_Row; -- -------------------------------------------------------------------- -- "&": -- Concatenates two matrices into upper left and lower right -- corners -- of the returned matrix. -- function "&" (M1, M2 : Matrix) return Matrix is Result : Matrix (Index'first .. Index'first + M1'length(1) + M2'length(1) - 1, Index'first .. Index'first + M1'length(2) + M2'length(2) - 1); -- := (others => (others => 0.0)); Zero1 : constant Vector (M1'range(2)) := (others => 0.0); Zero2 : constant Vector (M2'range(2)) := (others => 0.0); begin for I in M1'range(1) loop Set_Row (Result, Result'first + I - M1'first(1), To => Row (M1, I) & Zero2); --^ Error here ***** end loop; for I in M2'range(1) loop Set_Row (Result, Result'first + M1'length(1) + I - M2'first(1), To => Zero1 & Row (M2, I)); end loop; return Result; end "&"; end Fun_Matrix; with Fun_Matrix; procedure Fun is type Real is digits 15; type Vector is array (Positive range <>) of Real; type Matrix is array (Positive range <>, Positive range <>) of Real; package Math is new Fun_Matrix (Real, Positive, Vector, Matrix); use Math; begin null; end Fun; The error message is invalid operand types for operator "&" This error does not occur if the order of the operands is reversed, nor if the package is not generic (it is labeled an "instantiation error", so that's not surprising). Any assistance would be greatly appreciated. Jeff Carter PGP:1024/440FBE21 My real e-mail address: ( carter @ innocon . com ) "You empty-headed animal-food-trough wiper." Monty Python & the Holy Grail Posted with Spam Hater - see http://www.compulink.co.uk/~net-services/spam/