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=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE, MSGID_SHORT autolearn=no autolearn_force=no version=3.4.4 Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!sun-barr!lll-winken!taurus!castor!barnes From: barnes@castor.cs.nps.navy.mil (patrick barnes) Newsgroups: comp.lang.ada Subject: Renaming in a generic package Message-ID: <1713@castor.cs.nps.navy.mil> Date: 30 Nov 90 13:26:40 GMT Organization: Naval Postgraduate School,Monterey,CA List-Id: 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