From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Date: 8 Apr 92 15:41:08 GMT From: wdl39!mab@ford-wdl1.arpa (Mark A Biggar) Subject: Re: Ada 9X plans for Generic Formal Packages Message-ID: <1992Apr8.154108.2294@wdl.loral.com> List-Id: In article <1992Apr7.192922.24708@software.org> smithd@software.org (Doug Smith ) writes: >A quick look at the March 92 Draft Ada 9X Project Report revealed >a new item: > S.12.1.4 Generic Formal Packages [new] >However, the accompanying description and example leaves out a >lot of detail: > o How does the generic instantiate the formal package > (named associations, etc.?) It doesn't. The actual argument to a generic instantiation with a generic formal package parameter is an already instantiated package, which must be an instance of the generic package specified in the generic formal part. For example: ------------------------------------------------ generic type FLOAT_T is digits <>; package Gen_Complex is ... -- defines type COMPLEX, +, -, *, etc. end Gen_Complex; generic with package Complex is new Gen_Complex(<>); package Gen_Complex_Functions is ... -- defines sin, cos, exp, log, etc end Gen_Complex_Functions; type MY_FLOAT is digits 23; package MY_COMPLEX is new Gen_Complex(MY_FLOAT); package MY_COMPLEX_FUNCTIONS is new Gen_Complex_Functions(MY_COMPLEX); --------------------------------------------------- Note that the actual argument to Gen_Complex_Functions in the final instantiation is the already instantiated package MY_COMPLEX. > o How are the profiles of the actual packages mapped > to the profiles of the generic formal packages? By requiring that the actual argument to the generic be only instantiations of the given formal generic package, no mapping is necessary as all possible arguments have identical profiles. > o How will defaults work? They don't as there are no defaults for generic formal package parameters. >Can anyone point me to further information concerning this >feature. I have suggested something similar to several >people and see a great deal of power behind it--if it >really is what it appears to be: Providing generic >packages as formal parameters to generic packages! -- Mark Biggar mab@wdl1.wdl.loral.com