From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,84b1828b2b26fc4f X-Google-Attributes: gid103376,public From: steve.folly@rdel.co.uk (Steve Folly) Subject: Re: Common ancestor (visibility rules) Date: 2000/03/28 Message-ID: <38e09973.69788520@news.rrds.co.uk>#1/1 X-Deja-AN: 603369597 References: <8bprin$a37$1@nnrp1.deja.com> X-Complaints-To: postmaster@rdel.co.uk X-Trace: rdel.co.uk 954243816 18488 172.16.115.146 (28 Mar 2000 11:43:36 GMT) Organization: RDEL NNTP-Posting-Date: 28 Mar 2000 11:43:36 GMT Newsgroups: comp.lang.ada Date: 2000-03-28T11:43:36+00:00 List-Id: On Tue, 28 Mar 2000 08:47:22 GMT, dmitry6243@my-deja.com did clatter that keyboard and type: >Hello! > >Perhaps I've missed something, but it seems that compilation units >(except for library ones) do not have common ancestor. Here is a simple >example to highlight the problem: >------------------- a.ads >package A is > procedure Foo; >end A; >------------------- b.ads >package B is > procedure A; >end B; >------------------- b.adb >package body B is > procedure A is separate; >end B; >------------------- b-a.adb >with A; >separate (B) >procedure A is >begin > A.Foo; -- Error! >end A; > >Now there is no way to use A.Foo in B.A, because B.A hides A. The >problem could be easily solved if all compilation unit had have a common >ancestor package, say "Root". Then package A could be specified as >Root.A and A's Foo as Root.A.Foo. Interesting is that C++ has this >feature. > Well, the Ada95 team beat you to it, 10.1.1(1) of the LRM states: "A library_item is a compilation unit that is the declaration, body, or renaming of a library unit. Each library unit (except Standard) has a parent unit, which is a library package or generic library package. A library unit is a child of its parent unit. The root library units are the children of the predefined library package Standard. " Which, in layman's terms means any specific non-child package is implicitly a child of package Standard. So to get your separate A procedure to compile you need to fully qualify A.Foo as Standard.A.Foo. Hope that helps. Steve Folly.