* Package names & visibility
@ 1996-07-03 0:00 John Woodruff B481
1996-07-05 0:00 ` Jon S Anthony
0 siblings, 1 reply; 4+ messages in thread
From: John Woodruff B481 @ 1996-07-03 0:00 UTC (permalink / raw)
I find myself puzzled by some consequence of a visibility rule in naming
packages, and I wonder if I need to reconsider my plan for making up
these names (of if there is a simple re-phrasing that I should know).
In very simple form, I have a package specification that declares some
type (and other declarations as well of course).
Let's say my system will have motors, sensors, switches, etc. So I will
operate my motors with a package such as
package Motor is
type Yes_It_Is is new Integer ;
end Motor ;
But I need other information in addition to the direct control that I'll
implement in the package Motor. Therefore I thought I'd make a family
of packages to hold info about motors and sensors etc
package Info_About is
-- a package that will have children
end Info_about ;
My intention is to have children packages carry different sorts of
info_about; So there will be a package
with Motor ;
package Info_About.Motor is
A : Motor.Yes_It_Is ;
-- (I'm not *really* going to declare a visible object!)
end ;
My thinking was that Info_about.Motor will hold some data values (which
are of types defined by the Motor package).
But I can't seem to refer to the type Yes_It_Is! My friend Gnat tells me
info_about-motor.ads:3:13: "Yes_It_Is" not declared in "Motor"
This message clearly states that the visibility of info_about.motor is
hiding the package Motor where the type is declared.
Please suggest a way that I can refer to the identifiers that are
declared in Motor from inside the package Info_about.motor. Thx!
--
John Woodruff N I F \ ^ /
Lawrence Livermore National Lab =====---- < 0 >
510 422 4661 / v \
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Package names & visibility
1996-07-03 0:00 Package names & visibility John Woodruff B481
@ 1996-07-05 0:00 ` Jon S Anthony
1996-07-06 0:00 ` Robert A Duff
1996-07-08 0:00 ` Jon S Anthony
0 siblings, 2 replies; 4+ messages in thread
From: Jon S Anthony @ 1996-07-05 0:00 UTC (permalink / raw)
In article <udspb9atdo.fsf@calaveras.llnl.gov> woodruff@calaveras.llnl.gov (John Woodruff B481) writes:
> with Motor ;
> package Info_About.Motor is
> A : Motor.Yes_It_Is ;
> -- (I'm not *really* going to declare a visible object!)
> end ;
>
> My thinking was that Info_about.Motor will hold some data values (which
> are of types defined by the Motor package).
>
> But I can't seem to refer to the type Yes_It_Is! My friend Gnat tells me
> info_about-motor.ads:3:13: "Yes_It_Is" not declared in "Motor"
>
> This message clearly states that the visibility of info_about.motor is
> hiding the package Motor where the type is declared.
>
> Please suggest a way that I can refer to the identifiers that are
> declared in Motor from inside the package Info_about.motor. Thx!
Maybe this should (is?) in the FAQ. Two ways:
1. Everything is rooted at Standard, so refer to the "outside" Motor as
Standard.Motor: A : Standard.Motor.Yes_It_Is;
2. Provide a renaming for "outside" Motor before entering scope of child
Motor. Maybe in Info_About or at library level.
Option #1 is really the preferred IMO.
/Jon
--
Jon Anthony
Organon Motives, Inc.
1 Williston Road, Suite 4
Belmont, MA 02178
617.484.3383
jsa@organon.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Package names & visibility
1996-07-05 0:00 ` Jon S Anthony
@ 1996-07-06 0:00 ` Robert A Duff
1996-07-08 0:00 ` Jon S Anthony
1 sibling, 0 replies; 4+ messages in thread
From: Robert A Duff @ 1996-07-06 0:00 UTC (permalink / raw)
In article <JSA.96Jul5140611@organon.com>,
Jon S Anthony <jsa@organon.com> wrote:
...[two reasonable solutions omitted]
>Option #1 is really the preferred IMO.
My preference is to avoid using the same name for two different
packages, especially when those packages reference each other, or are
used together.
- Bob
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Package names & visibility
1996-07-05 0:00 ` Jon S Anthony
1996-07-06 0:00 ` Robert A Duff
@ 1996-07-08 0:00 ` Jon S Anthony
1 sibling, 0 replies; 4+ messages in thread
From: Jon S Anthony @ 1996-07-08 0:00 UTC (permalink / raw)
In article <Du4v94.8CK@world.std.com> bobduff@world.std.com (Robert A Duff) writes:
> In article <JSA.96Jul5140611@organon.com>,
> Jon S Anthony <jsa@organon.com> wrote:
> ...[two reasonable solutions omitted]
> >Option #1 is really the preferred IMO.
>
> My preference is to avoid using the same name for two different
> packages, especially when those packages reference each other, or are
> used together.
>
> - Bob
Oh, you mean the _really_ really preferred approach!
/Jon
--
Jon Anthony
Organon Motives, Inc.
1 Williston Road, Suite 4
Belmont, MA 02178
617.484.3383
jsa@organon.com
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~1996-07-08 0:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-07-03 0:00 Package names & visibility John Woodruff B481
1996-07-05 0:00 ` Jon S Anthony
1996-07-06 0:00 ` Robert A Duff
1996-07-08 0:00 ` Jon S Anthony
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox