comp.lang.ada
 help / color / mirror / Atom feed
* Package parameters in generic packages
@ 1996-07-08  0:00 Chris Papademetrious
  1996-07-09  0:00 ` Robert A Duff
  0 siblings, 1 reply; 2+ messages in thread
From: Chris Papademetrious @ 1996-07-08  0:00 UTC (permalink / 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
-=-=-=-=-=-=-=-=-=-=-=-=-





^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Package parameters in generic packages
  1996-07-08  0:00 Package parameters in generic packages Chris Papademetrious
@ 1996-07-09  0:00 ` Robert A Duff
  0 siblings, 0 replies; 2+ messages in thread
From: Robert A Duff @ 1996-07-09  0:00 UTC (permalink / raw)



In article <4rs1vn$6t8@noc2.drexel.edu>,
Chris Papademetrious <st92j0gw@dunx1.ocs.drexel.edu> wrote:
> 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?  

No.

- Bob




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1996-07-09  0:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-07-08  0:00 Package parameters in generic packages Chris Papademetrious
1996-07-09  0:00 ` Robert A Duff

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