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,4a6713d7148c1596,start X-Google-Attributes: gid103376,public From: noiraud@cenaath.cena.dgac.fr Subject: Generic child unit renaiming Date: 1999/04/22 Message-ID: <7fn4vg$298$1@ilana.cenaath.cena.dgac.fr>#1/1 X-Deja-AN: 469534779 Organization: Centre d'Etudes de la Navigation Aerienne, France Newsgroups: comp.lang.ada Date: 1999-04-22T00:00:00+00:00 List-Id: I would like to rename Math_Extension an extension of the generic package Ada.Numerics.Generic_Elementary_Functions. Thus, I created a generic child unit : generic package Ada.Numerics.Generic_Elementary_Functions.Extensions is function Log10 (X : Float_Type'Base) return Float_Type'Base; function Asin (X : Float_Type'Base) return Float_Type'Base renames Arcsin; end Ada.Numerics.Generic_Elementary_Functions.Extensions; and I tried the following renaming : with Ada.Numerics.Generic_Elementary_Functions.Extensions; generic package Math_Extension renames Ada.Numerics.Generic_Elementary_Functions.Extensions; The GNAT compiler refused it : >>> invalid prefix in selected component "Generic_Elementary_Functions". I read that a child of a generic parent can only be renamed if the renaming occurs inside the declarative region of its parent unit, but I can't do it because Generic_Elementary_Functions belongs to the predefined library. An other solution could be to implement in Math_Extension package using an instanciation of Generic_Elementary_Functions : generic type Real is digits <>; package Math_Extension is package Math is new Ada.Numerics.Generic_Elementary_Functions (Real); function Sqrt (X : Real'Base) return Real'Base renames Math.Sqrt; ... function Log10 (X : Real'Base) return Real'Base; function Asin (X : Real'Base) return Real'Base renames Math.Arcsin; end Math_Extension; but instanciate Math_Extension has a performance cost because of the double instanciation. Could anyone help me ? Thanks in advance.