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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,c4ba91f4ae36a2c X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!news1.google.com!news.glorb.com!xmission!newsswitch.lcs.mit.edu!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Elaborate_All on child package Date: Tue, 06 Sep 2011 08:51:43 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <19a85f93-3cd2-4054-8022-21ba294d53e3@glegroupsg2000goo.googlegroups.com> <507f7b91-0fab-4f62-86e1-8185aff2315c@glegroupsg2000goo.googlegroups.com> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: pcls6.std.com 1315313503 15620 192.74.137.71 (6 Sep 2011 12:51:43 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Tue, 6 Sep 2011 12:51:43 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:6Vh1xO0H27zZlG4LQi2xg3oOr/E= Xref: g2news2.google.com comp.lang.ada:21830 Date: 2011-09-06T08:51:43-04:00 List-Id: Egil H�vik writes: > On Saturday, September 3, 2011 6:57:16 PM UTC+2, Rego, P. wrote: >> However, should it be done this way? Due to it is already "withed" to the parent package, so why have I make a new with? I mean: why is the following code incorrect: >> pragma Elaborate_All (Forum_Test); > > Forum_Test is unknown. It is not defined in this scope. Right. The visibility rules in context clauses are special. They have to be, because the context clause are determining what's visible elsewhere. Why Jean Ichbiah chose this exact design, I don't know. I would have put the 'with' clauses inside the package. >> package Forum_Test.Childp is <....> > > Implicit with happens here, after Elaborate_All Nitpick: There is no such thing as an "implicit with" in Ada. The semantics of parent/child units are defined in terms of the child being _inside_ the parent. That is, Forum_Test is visible in Childp because Childp is inside Forum_Test, not because of an "implicit with". Inside Childp, things declared in Forum_Test are directly visible. If the semantics were defined in terms of "implicit with", then you would have to say "use Forum_Test;" to make those things directly visible. Also, things declared in the private part of Forum_Test are directly visible in (parts of) Childp; they wouldn't be visible at all in the "implicit with" semantics. >> and why is the following code correct? >> with Forum_Test; >> pragma Elaborate_All (Forum_Test); >> package Forum_Test.Childp is <....> > > Here, Forum_Test is known to the pragma, due to the explicit with. Right. > Would you expect this to compile: > > pragma Elaborate_All(Forum_Test); > with Forum_Test; Right, that's illegal. - Bob