comp.lang.ada
 help / color / mirror / Atom feed
* Visibility of package within package
@ 1996-07-31  0:00 Erik Masella
  1996-08-01  0:00 ` Tucker Taft
  0 siblings, 1 reply; 6+ messages in thread
From: Erik Masella @ 1996-07-31  0:00 UTC (permalink / raw)



Hello,

Could anybody explain to me why the following will not work:

with Generic_Pkg;

package A_Pkg is

   package B_Pkg is new Generic_Pkg(...);

..
end A_Pkg;

--------------------------------

with A_Pkg;

package body C_Pkg is

   procedure Init is
   begin
      A_Pkg.B_Pkg.Do_Something(...);
   end Init;

end C_Pkg;


==> Why isn't B_Pkg visible within C_Pkg?  From what I understand,
"Software Engineering with Ada" from Booch (2nd ed.) says at p.383 that
this is possible (but he did not use generics).

I'd greatly appreciate some insight into this.
Thanks in advance.

Erik Masella
emasella@mtl.marconi.ca




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

* Re: Visibility of package within package
  1996-08-01  0:00   ` Chad Bremmon
@ 1996-08-01  0:00     ` Robert A Duff
  1996-08-02  0:00     ` Tucker Taft
  1 sibling, 0 replies; 6+ messages in thread
From: Robert A Duff @ 1996-08-01  0:00 UTC (permalink / raw)



In article <32009A4C.147C@comm.hq.af.mil>,
Chad Bremmon  <chad.bremmon@comm.hq.af.mil> wrote:
>Don't you still have to with in "With A_Pkg.BPkg;" inside of your C_Pkg ?

No.  With_clauses are only for library units.

- Bob




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

* Re: Visibility of package within package
  1996-08-01  0:00 ` Tucker Taft
@ 1996-08-01  0:00   ` Chad Bremmon
  1996-08-01  0:00     ` Robert A Duff
  1996-08-02  0:00     ` Tucker Taft
  0 siblings, 2 replies; 6+ messages in thread
From: Chad Bremmon @ 1996-08-01  0:00 UTC (permalink / raw)



Tucker Taft wrote:
> 
> Erik Masella (emasella@mtl.marconi.ca) wrote:
> 
> : Could anybody explain to me why the following will not work:
> 
> : with Generic_Pkg;
> : package A_Pkg is
> :    package B_Pkg is new Generic_Pkg(...);
> : ..
> : end A_Pkg;
> 
> : --------------------------------
> 
> : with A_Pkg;
> : package body C_Pkg is
> :    procedure Init is
> :    begin
> :       A_Pkg.B_Pkg.Do_Something(...);
> :    end Init;
> : end C_Pkg;
> 
> : ==> Why isn't B_Pkg visible within C_Pkg?  From what I understand,
> : "Software Engineering with Ada" from Booch (2nd ed.) says at p.383 that
> : this is possible (but he did not use generics).
> 
> : I'd greatly appreciate some insight into this.
> 
> Your code looks OK, but it is hard to be sure without a complete
> example, since we don't know what is inside "Generic_Pkg".  When
> you have mysteries like this, it is most useful to include an
> actual listing with error messages from the compiler.  Surprisingly
> often, there is some other problem than the one you first suspect.
> 
> In any case, it is possible that the compiler has a bug, but your
> example is so simple and straightforward that it seems more likely
> that something else is wrong.

Don't you still have to with in "With A_Pkg.BPkg;" inside of your C_Pkg ?

Chad
> 
> : Erik Masella
> : emasella@mtl.marconi.ca
> 
> -Tucker Taft   stt@inmet.com   http://www.inmet.com/~stt/
> Intermetrics, Inc.  Cambridge, MA  USA




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

* Re: Visibility of package within package
  1996-07-31  0:00 Visibility of package within package Erik Masella
@ 1996-08-01  0:00 ` Tucker Taft
  1996-08-01  0:00   ` Chad Bremmon
  0 siblings, 1 reply; 6+ messages in thread
From: Tucker Taft @ 1996-08-01  0:00 UTC (permalink / raw)



Erik Masella (emasella@mtl.marconi.ca) wrote:

: Could anybody explain to me why the following will not work:

: with Generic_Pkg;
: package A_Pkg is
:    package B_Pkg is new Generic_Pkg(...);
: ..
: end A_Pkg;

: --------------------------------

: with A_Pkg;
: package body C_Pkg is
:    procedure Init is
:    begin
:       A_Pkg.B_Pkg.Do_Something(...);
:    end Init;
: end C_Pkg;


: ==> Why isn't B_Pkg visible within C_Pkg?  From what I understand,
: "Software Engineering with Ada" from Booch (2nd ed.) says at p.383 that
: this is possible (but he did not use generics).

: I'd greatly appreciate some insight into this.

Your code looks OK, but it is hard to be sure without a complete
example, since we don't know what is inside "Generic_Pkg".  When
you have mysteries like this, it is most useful to include an
actual listing with error messages from the compiler.  Surprisingly
often, there is some other problem than the one you first suspect.

In any case, it is possible that the compiler has a bug, but your
example is so simple and straightforward that it seems more likely
that something else is wrong.

: Erik Masella
: emasella@mtl.marconi.ca

-Tucker Taft   stt@inmet.com   http://www.inmet.com/~stt/
Intermetrics, Inc.  Cambridge, MA  USA




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

* Re: Visibility of package within package
  1996-08-01  0:00   ` Chad Bremmon
  1996-08-01  0:00     ` Robert A Duff
@ 1996-08-02  0:00     ` Tucker Taft
  1 sibling, 0 replies; 6+ messages in thread
From: Tucker Taft @ 1996-08-02  0:00 UTC (permalink / raw)



Erik Masella (emasella@mtl.marconi.ca) wrote:

> Could anybody explain to me why the following will not work:
> 
> with Generic_Pkg;
> package A_Pkg is
>    package B_Pkg is new Generic_Pkg(...);
> ..
> end A_Pkg;
> 
> --------------------------------
> 
> with A_Pkg;
> package body C_Pkg is
>    procedure Init is
>    begin
>       A_Pkg.B_Pkg.Do_Something(...);
>    end Init;
> end C_Pkg;
> 
> ==> Why isn't B_Pkg visible within C_Pkg?  From what I understand,
> "Software Engineering with Ada" from Booch (2nd ed.) says at p.383 that
> this is possible (but he did not use generics).
> 
> I'd greatly appreciate some insight into this.

Tucker Taft wrote:

> Your code looks OK, but it is hard to be sure without a complete
> example, since we don't know what is inside "Generic_Pkg".  When
> you have mysteries like this, it is most useful to include an
> actual listing with error messages from the compiler.  Surprisingly
> often, there is some other problem than the one you first suspect.
> 
> In any case, it is possible that the compiler has a bug, but your
> example is so simple and straightforward that it seems more likely
> that something else is wrong.

Chad Bremmon (chad.bremmon@comm.hq.af.mil) wrote:

> Don't you still have to with in "With A_Pkg.BPkg;" inside of your C_Pkg ?

No.  B_Pkg is not a separate library unit.  You only need to mention
library units in "with" clauses.  B_Pkg is physically nested inside
A_Pkg, so it is a mystery why the above doesn't compile.  Again, a
complete example, with compiler messages, is the only way to figure it out.

> Chad

: > : Erik Masella
: > : emasella@mtl.marconi.ca

-Tucker Taft   stt@inmet.com   http://www.inmet.com/~stt/
Intermetrics, Inc.  Cambridge, MA  USA




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

* Re: Visibility of package within package
@ 1996-08-02  0:00 Erik Masella
  0 siblings, 0 replies; 6+ messages in thread
From: Erik Masella @ 1996-08-02  0:00 UTC (permalink / raw)



stt@henning.camb.inmet.com (Tucker Taft) writes: > Erik Masella (emasella@mtl.marconi.ca) wrote:
> 
> > Could anybody explain to me why the following will not work:
> > 
> > with Generic_Pkg;
> > package A_Pkg is
> >    package B_Pkg is new Generic_Pkg(...);
> > ..
> > end A_Pkg;
> > 
> > --------------------------------
> > 
> > with A_Pkg;
> > package body C_Pkg is
> >    procedure Init is
> >    begin
> >       A_Pkg.B_Pkg.Do_Something(...);
> >    end Init;
> > end C_Pkg;
> > 
> > ==> Why isn't B_Pkg visible within C_Pkg?  From what I understand,
> > "Software Engineering with Ada" from Booch (2nd ed.) says at p.383 that
> > this is possible (but he did not use generics).
> > 
> > I'd greatly appreciate some insight into this.
> 
> Tucker Taft wrote:
> 
> > Your code looks OK, but it is hard to be sure without a complete
> > example, since we don't know what is inside "Generic_Pkg".  When
> > you have mysteries like this, it is most useful to include an
> > actual listing with error messages from the compiler.  Surprisingly
> > often, there is some other problem than the one you first suspect.
> > 
> > In any case, it is possible that the compiler has a bug, but your
> > example is so simple and straightforward that it seems more likely
> > that something else is wrong.
> 
> Chad Bremmon (chad.bremmon@comm.hq.af.mil) wrote:
> 
> > Don't you still have to with in "With A_Pkg.BPkg;" inside of your C_Pkg ?
> 
> No.  B_Pkg is not a separate library unit.  You only need to mention
> library units in "with" clauses.  B_Pkg is physically nested inside
> A_Pkg, so it is a mystery why the above doesn't compile.  Again, a
> complete example, with compiler messages, is the only way to figure it out.
> 
> > Chad
> 
> : > : Erik Masella
> : > : emasella@mtl.marconi.ca
> 
> -Tucker Taft   stt@inmet.com   http://www.inmet.com/~stt/
> Intermetrics, Inc.  Cambridge, MA  USA

I seemed to have fixed the problem but don't understand how...

When I initially tried the above example, I compiled the first file 
(containing A_Pkg and B_Pkg), then I compiled C_Pkg which caused the 
aformentioned error.  Then I recompiled my whole project library from scratch
and now C_Pkg compiled with no errors.  I don't get it because C_Pkg
depends directly on A_Pkg...

Anyways, I guess it is a compiler/maker type of problem, but certainly not
an Ada problem.

Sorry for the interruption.





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

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

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-07-31  0:00 Visibility of package within package Erik Masella
1996-08-01  0:00 ` Tucker Taft
1996-08-01  0:00   ` Chad Bremmon
1996-08-01  0:00     ` Robert A Duff
1996-08-02  0:00     ` Tucker Taft
  -- strict thread matches above, loose matches on Subject: below --
1996-08-02  0:00 Erik Masella

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