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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.99.112.81 with SMTP id a17mr18342238pgn.28.1495685199422; Wed, 24 May 2017 21:06:39 -0700 (PDT) X-Received: by 10.157.13.170 with SMTP id 39mr298881ots.18.1495685199379; Wed, 24 May 2017 21:06:39 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.glorb.com!67no306148itx.0!news-out.google.com!v18ni1338ita.0!nntp.google.com!67no308917itx.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 24 May 2017 21:06:39 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=173.71.201.205; posting-account=QF6XPQoAAABce2NyPxxDAaKdAkN6RgAf NNTP-Posting-Host: 173.71.201.205 References: <4a47e4cd-829c-4451-abf1-82cf60b67706@googlegroups.com> <9cdf04e6-123e-4bd9-b466-77aad00d61bb@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Preventing private procedure visibility being made public through extension From: Jere Injection-Date: Thu, 25 May 2017 04:06:39 +0000 Content-Type: text/plain; charset="UTF-8" Xref: news.eternal-september.org comp.lang.ada:46863 Date: 2017-05-24T21:06:39-07:00 List-Id: On Monday, May 22, 2017 at 5:17:47 PM UTC-4, Randy Brukardt wrote: > "Jere" wrote in message > ... > > Definitely. I am also worried about someone copying the access > > value and holding onto it past the lifetime of the object. I try > > to avoid Access types when I can. I wish there was someway to > > actually pass a limited type as a function return that didn't > > involve build in place that can initialize. I just want to be > > able to return the limited object out temporarily to access it: > > That's what generalized references are for. See 4.1.5 in the RM. > > Randy. That's a good point. I did end up playing with this and getting an example working. After going through Jeffrey's example, I ended up scrapping the access types altogether, but I do need to learn to leverage this more in cases where access types are necessary. Side question: If I have a type (Gnoga'ish example): type View_Base_Type is new Element_Type with private; --taggeed type View_Type is new View_Base_Type with private; procedure Create (View : in out View_Type; Parent : in out Base_Type'Class; ID : in String := ""); -- Excuse any typos, this is hand typed code And then I extend it: type My_Type is new View_Base_Type with private; procedure Create (Obj : in out My_Type; Parent : in out Window_Type'Class; -- derived from Base_Type'Class ID : in String := ""); private type My_Type is new View_Type with null record; Sometimes if I subtype or extend My_Type, I get the ambiguous calls to Create issue due to the inherited Create function from View_Type. Since the extension of View_Type was private (I publicly extended View_Base_Type), should there still be an ambiguity between the Create procedures? My new one shouldn't be an override and since the extension to View_Type is private, it shouldn't be callable (I'm not in a child package, this would be just some other unrelated package subtyping or extending My_Type). I get that before my extension was public so making the Create procedure private wasn't an option, but I had hoped with the full view being private it wouldn't cause the ambiguity. I realize in code that could view the private section the issue might still be there, but this wouldn't be a package that can see the private section.