comp.lang.ada
 help / color / mirror / Atom feed
From: wdl39!mab@ford-wdl1.arpa  (Mark A Biggar)
Subject: Re: Ada 9X plans for Generic Formal Packages
Date: 8 Apr 92 15:41:08 GMT	[thread overview]
Message-ID: <1992Apr8.154108.2294@wdl.loral.com> (raw)

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

             reply	other threads:[~1992-04-08 15:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1992-04-08 15:41 Mark A Biggar [this message]
  -- strict thread matches above, loose matches on Subject: below --
1992-04-13 22:13 Ada 9X plans for Generic Formal Packages Doug Smith
1992-04-08 13:02 Arthur Evans
1992-04-07 19:29 cis.ohio-state.edu!zaphod.mps.ohio-state.edu!mips!darwin.sura.net!uvaarpa
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox