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 X-Google-Attributes: gid103376,public From: Matthew Heaney Subject: Re: Generic child unit renaiming Date: 1999/04/25 Message-ID: #1/1 X-Deja-AN: 470821663 References: <7fn4vg$298$1@ilana.cenaath.cena.dgac.fr> NNTP-Posting-Date: Sun, 25 Apr 1999 15:17:25 PDT Newsgroups: comp.lang.ada Date: 1999-04-25T00:00:00+00:00 List-Id: noiraud@cenaath.cena.dgac.fr writes: > I would like to rename Math_Extension an extension of the > generic package Ada.Numerics.Generic_Elementary_Functions. Don't do this. > 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. I don't know what you mean by "performance cost," but you can always import the instantiation as a generic formal package: with Ada.Numerics.Generic_Elementary_Functions; use Ada.Numerics; generic type Real is digits <>; with package Math is new Generic_Elementary_Functions (Real); package Math_Extension is ...;