From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Path: eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Re: Visibility issue Date: Fri, 11 Sep 2020 16:23:23 +0200 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Fri, 11 Sep 2020 14:23:24 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="1575c382aca6abc4c9024b5d7f4188f8"; logging-data="31290"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18wM5MoBd4U5rF2huLD2a7bQAtRlLmC+DI=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 Cancel-Lock: sha1:eOFwUXi87BmW1b6kY7NVYZ9HmP8= In-Reply-To: Content-Language: en-US Xref: reader01.eternal-september.org comp.lang.ada:60112 List-Id: On 9/11/20 12:37 PM, Daniel wrote: > > package Library.Users is > type User_type is tagged with private; > procedure foo_public (S: User_Type); > private > type User_Type is tagged with record > hide_content_to_user : Natural; > end record; > function Access_to_hide_content return User_type; > end Library.Users; > > private with Library.Users; > package Internal_Library_Implementing is > -- Some internal public developer stuff > private > --Here I want to get access to User_Type hide content. > end Internal_Library_Implementing; > > I've tried using "private with" but gnat says the next: > move subprogram to the visible part (RM 3.9.3(10)) > private function with tagged result must override visible-part function > > Compiler says Im forced to make all private User_type functions public. > So, are there more ways to see the hided content of this tagged type without extending the type itself in a child package? I needed to see this content outside of Library package. The private part is only visible to the body and to child pkgs. So if you declared private package Library.Users.Internal_Implementation is then it will be able to see the private part of Library.Users. Because it's a private pkg, it cannot be used by clients. -- Jeff Carter "You couldn't catch clap in a brothel, silly English K...niggets." Monty Python & the Holy Grail 19