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-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!c19g2000yqc.googlegroups.com!not-for-mail From: Ludovic Brenta Newsgroups: comp.lang.ada Subject: Re: Indirect visibility of private part in child packages Date: Thu, 4 Jun 2009 00:50:10 -0700 (PDT) Organization: http://groups.google.com Message-ID: <5854cebc-55a9-469d-88bd-86b4704f8689@c19g2000yqc.googlegroups.com> References: <77683561-2b21-42c3-8c90-6c08a0c16b99@n21g2000vba.googlegroups.com> NNTP-Posting-Host: 153.98.68.197 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1244101811 10434 127.0.0.1 (4 Jun 2009 07:50:11 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 4 Jun 2009 07:50:11 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: c19g2000yqc.googlegroups.com; posting-host=153.98.68.197; posting-account=pcLQNgkAAAD9TrXkhkIgiY6-MDtJjIlC User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10,gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:6207 Date: 2009-06-04T00:50:10-07:00 List-Id: Maybe you can solve your problem like this: package body P1.P3 is procedure A_Primitive (Item : out T3_Type) is begin T1_Type (Item).Low_Level_Data := ...; end A_Primitive; end P1.P3; I am undecided whether the compiler is correct or wrong about the visibility of Low_Level_Data. On the one hand, P1.P3 cannot see the full declaration of T2_Type; on the other hand, it can see that T2_Type publicly inherits from T1_Type and can also see the full declaration of T1_Type. It seems that the public (partial) view of T2_Type hides the full declaration of T1_Type. So, I think my solution would work by removing T2_Type out of the way. Another solution, which enforces encapsulation better, would be: package P1 is type T1_Type is tagged private; private type Some_Type is ...; type T1_Type is tagged record Low_Level_Data : Some_Type; end record; procedure Set (Item : out T1_Type; Data : in Some_Type); end P1; package body P1.P3 is procedure A_Primitive (Item : out T3_Type) is begin Set (Item, Data => ...); -- OK, calls inherited primitive operation end A_Primitive; end P1.P3; HTH -- Ludovic Brenta.