From: Ted Dennison <dennison@telepath.com>
Subject: LLQ: Scope and child package names
Date: 2000/08/10
Date: 2000-08-10T00:00:00+00:00 [thread overview]
Message-ID: <8mv91i$bfr$1@nnrp1.deja.com> (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.
next reply other threads:[~2000-08-10 0:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-08-10 0:00 Ted Dennison [this message]
2000-08-11 0:00 ` LLQ: Scope and child package names 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