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.0 required=3.0 tests=BAYES_40,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.5-pre1 X-Received: by 2002:ac8:4295:: with SMTP id o21mr30206848qtl.241.1600359026982; Thu, 17 Sep 2020 09:10:26 -0700 (PDT) X-Received: by 2002:ad4:56a6:: with SMTP id bd6mr29103095qvb.25.1600359026780; Thu, 17 Sep 2020 09:10:26 -0700 (PDT) Path: eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!news.gegeweb.eu!gegeweb.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Thu, 17 Sep 2020 09:10:26 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: google-groups.googlegroups.com; posting-host=96.247.204.159; posting-account=QF6XPQoAAABce2NyPxxDAaKdAkN6RgAf NNTP-Posting-Host: 96.247.204.159 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <1946b772-2351-420a-97d9-f79444d37017n@googlegroups.com> Subject: Re: Visibility issue From: Jere Injection-Date: Thu, 17 Sep 2020 16:10:26 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader02.eternal-september.org comp.lang.ada:60184 List-Id: On Friday, September 11, 2020 at 6:37:29 AM UTC-4, Daniel wrote: > Hello, > I want to use a tagged type as a link to communicate users of a library, in the way to make one part visible to them and also to hide some content that is only needed for the implementing of the library. > > Lets say i have the "Library" packages to expose things to users, and Implementing_Library packages to deal with the implementation: > > 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. One side note and I hope you don't take this comment negatively but instead as a chance to improve communication: I started out trying to take what you provided and figure out a solution and quickly realized that I would need to take hours to create an example to even work with because none of the examples you provided were close to compilable. I quickly gave up and moved to higher level discussion. If you really want more direct answers consider making a small fully compilable example for people to play with and make adjustments too. For things you want but wouldn't compile, place inline comments in your code clearly specifying what you want to change or what is missing. That gives others a workable template to play with. They can take your example, compile it and then make changes to try and implement some of the requirements better without having to guess at what you really want. Again, not saying that to be negative, but wanted to at least give that feedback to help you get better answers in the future.