comp.lang.ada
 help / color / mirror / Atom feed
From: "Matthew Heaney" <matthew_heaney@acm.org>
Subject: Re: package child question
Date: 2000/02/08
Date: 2000-02-08T00:00:00+00:00	[thread overview]
Message-ID: <TpLn4.2396$pH6.21376@newsread1.prod.itd.earthlink.net> (raw)
In-Reply-To: 87mugk$sa3$1@news-hrz.uni-duisburg.de

In article <87mugk$sa3$1@news-hrz.uni-duisburg.de> , 
sb463ba@d250-hrz.uni-duisburg.de (Georg Bauhaus) wrote:

> with A.B;
> package body B.A is
>
> begin
>    declare
>       use A.B;  -- compiler says: "B" not declared in "A"
>    begin
>       null;
>    end;
> end B.A;
>
> This only happens if the use clause is in A.B body statements,
> there is no error message when it is in the context clause of A.B.

A name always denotes the entity with the most inner scope.  In your
case, the name "A" denotes the package B.A, because that is the A-entity
declared in the most inner scope.

> Is there a way out of this, other than choosing different names
> (which works)?

You could try doing a library-level package renames:

-- this is its own file, say ab.ads
package AB renames A.B;

-- now with the renamed package:
with AB;
package body B.A is
begin
  declare
    use AB;
  begin
    null;
  end;
end B.A;

I haven't tried compiling this, though.


--
Celebrate Darwin Day on Saturday, 12 February!

<http://www.bbc.co.uk/education/darwin/index.shtml>




  parent reply	other threads:[~2000-02-08  0:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-02-07  0:00 package child question Georg Bauhaus
2000-02-07  0:00 ` Jean-Pierre Rosen
2000-02-08  0:00   ` Steve Folly
2000-02-09  0:00     ` Jean-Pierre Rosen
2000-02-09  0:00       ` Georg Bauhaus
2000-02-09  0:00       ` Robert A Duff
2000-02-10  0:00         ` Ehud Lamm
2000-02-09  0:00           ` Marin D. Condic
2000-02-10  0:00             ` Larry Kilgallen
2000-02-10  0:00               ` Pascal Obry
2000-02-11  0:00       ` Steve Folly
2000-02-08  0:00 ` Matthew Heaney [this message]
  -- strict thread matches above, loose matches on Subject: below --
2000-02-08  0:00 Christoph Grein
replies disabled

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