From: st92j0gw@dunx1.ocs.drexel.edu (Chris Papademetrious)
Subject: Package parameters in generic packages
Date: 1996/07/08
Date: 1996-07-08T00:00:00+00:00 [thread overview]
Message-ID: <4rs1vn$6t8@noc2.drexel.edu> (raw)
I am seriously confused about how package parameters are supposed to
work. Everyone is familiar with the syntax:
generic
with package P is new Q(<>);
package X is
...
end X;
where a generic package itself is passed as a parameter for X so that
P inherits the generic parameter that this parameter package was
created with. I read in "Programming in Ada 95" by Barnes that it is
a special case that when the default form (<>) is used, the formal
parameter in package Q is also visible in P. Thus, if Q was defined
as:
generic
type Real is digits (<>);
package Q is
..
end Q;
then the type Real is able to be referenced as P.Real *inside* of X.
However, I was not able to reference P.Real inside of the package body
of X, only in the package *specification* of X. Is this normal? To
get around this, I had to do something like this in the specification:
subtype Foo is P.Real;
then use this Foo type in the package body of X! Messy, messy. What
am I not understanding? Incidentally, this all comes into play
because I am trying to create a vectors/matrix package that supports
complex numbers, but I need access to
Ada.Numerics.Generic_Complex_Types.Real
inside of the package for some of the vector/matrix operations. Any
help appreciated. I am hoping that the entire Ada 95 community will
benefit from my work when this package is released.
-=-=-=-=-=-=-=-=-=-=-=-=-
Chris Papademetrious
Data Fusion Laboratory
Drexel University
Philadelphia, PA
-=-=-=-=-=-=-=-=-=-=-=-=-
next reply other threads:[~1996-07-08 0:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-07-08 0:00 Chris Papademetrious [this message]
1996-07-09 0:00 ` Package parameters in generic packages Robert A Duff
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox