From: t_wolf@angelfire.com (Thomas Wolf)
Subject: Re: Visibility problems in Parent.Child configuration
Date: 31 Jul 2002 03:57:37 -0700
Date: 2002-07-31T10:57:37+00:00 [thread overview]
Message-ID: <719a5d07.0207310257.63c9645@posting.google.com> (raw)
In-Reply-To: 383f908a.0207300341.1047c075@posting.google.com
keld.nielsen@agip.it (Keld Lund Nielsen) wrote in message news:<383f908a.0207300341.1047c075@posting.google.com>...
> Dear All,
>
> a question regarding type visibility. The configuration is as follows:
>
> ----file Parent.ads:
> with Ada.Numerics.Generic_Elementary_Functions;
> package Parent is
>
> package Float_64 is
> type Instance is digits 15;
> for Instance'Size use 64;
> package Operations is
> new Ada.Numerics.Generic_Elementary_Functions( Instance );
> end Float_64;
>
> end Parent;
>
> ----file Parent.Generic_Child.ads:
> generic
> type Instance is private;
>
> package Parent.Generic_Child is
> --void...
> end Parent.Generic_Child;
>
>
> Then I create a test system with the structure:
>
> Test.Parent.Child
>
> but when I try to create an instance of Generic_Child or just declare
> a subtype of the Parent.Float_64.Instance, then the compiler protests
> and gives the message that Float_64 is not in Parent!
>
> Moreover, when instantiated from a simple package - say "my_package" -
> then it works perfectly, yet not from the "Test.Parent.Child".
That's because if you do e.g.
package Test.Parent.Child is
subtype My_Float is Parent.Float_64.Instance;
end Test.Parent.Child;
the name "Parent" refers to package "Test.Parent", not
to package "Parent". To refer from within "Test.Parent" or
one of its children to the top-level package "Parent", use
"Standard.Parent". E.g.
package Test.Parent.Child is
subtype My_Float is Standard.Parent.Float_64.Instance;
end Test.Parent.Child;
should work.
--
----------------------------------------------------------------
Thomas Wolf e-mail: t_wolf@angelfire.com
next prev parent reply other threads:[~2002-07-31 10:57 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-07-30 11:41 Visibility problems in Parent.Child configuration Keld Lund Nielsen
2002-07-30 19:04 ` Robert A Duff
2002-07-31 10:01 ` Keld Lund Nielsen
2002-08-01 19:09 ` Stephen Leake
2002-07-31 10:57 ` Thomas Wolf [this message]
2002-08-01 7:51 ` Keld Lund Nielsen
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox