comp.lang.ada
 help / color / mirror / Atom feed
* LLQ: Scope and child package names
@ 2000-08-10  0:00 Ted Dennison
  2000-08-11  0:00 ` Robert A Duff
  0 siblings, 1 reply; 2+ messages in thread
From: Ted Dennison @ 2000-08-10  0:00 UTC (permalink / raw)


My compiler's giving me some suprising (to my small mind) results in
this area, so I'd like to find out what the actual rules are in this
area.

Say I have two child packages, one of which "with"s the other. Let's
further stipulate that the name of the with-ee's parent happens to be
the same as the name of the with-or. For example:

package Foo.Utility is
   type Instance is...
...
end Foo.Utility;

with Foo.Utility;

package Facility.Foo is
...
   type Instance is new Foo.Utility.Instance;
end Facility.Foo;

My compiler gacks at this, saying Utility is not found in Foo. I'm
guessing the problem is that "Foo" inside of Facility.Foo is a shorthand
for Facility.Foo, hiding any "Foo" package hierarchy I may have with'ed.
Is that right?

Question 2:

It just so happened that I had a rename for the with-ee parent around.
So I tried using that, expecting failure becuase I had no such rename
for the child package. But to my suprise, it worked! Eg:

package Executive_Foo renames Foo;

with Executive_Foo.Utility;

package Facility.Foo is
...
   type Instance is new Executive_Foo.Utility.Instance;
end Facility.Foo;

This compiled happily. So a rename of a package effectively acts as a
rename for all its children too?

--
T.E.D.

http://www.telepath.com/~dennison/Ted/TED.html


Sent via Deja.com http://www.deja.com/
Before you buy.




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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-08-10  0:00 LLQ: Scope and child package names Ted Dennison
2000-08-11  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