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.107.53.225 with SMTP id k94mr11240927ioo.107.1512307995956; Sun, 03 Dec 2017 05:33:15 -0800 (PST) X-Received: by 10.157.83.199 with SMTP id i7mr514705oth.3.1512307995857; Sun, 03 Dec 2017 05:33:15 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!news.kjsl.com!usenet.stanford.edu!i6no2045329itb.0!news-out.google.com!s63ni2063itb.0!nntp.google.com!i6no2045327itb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sun, 3 Dec 2017 05:33:15 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=173.71.208.22; posting-account=QF6XPQoAAABce2NyPxxDAaKdAkN6RgAf NNTP-Posting-Host: 173.71.208.22 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <889a3aed-4e6b-49c8-8c1c-6f1478e8e077@googlegroups.com> Subject: Re: Full view of a private partial view cannot be a subtype From: Jere Injection-Date: Sun, 03 Dec 2017 13:33:15 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader02.eternal-september.org comp.lang.ada:49328 Date: 2017-12-03T05:33:15-08:00 List-Id: On Sunday, December 3, 2017 at 7:01:50 AM UTC-5, Jeffrey R. Carter wrote: > On 12/03/2017 03:14 AM, Jere wrote: > > > > package New_Type1 is > > subtype Instance is Base.Instance; > > procedure Operation(Object : in out Instance); > > private > > procedure Operation(Object : in out Instance) renames Base.Operation; > > You can make the renaming visible as well. There doesn't seem to be any reason > to hide the fact that Operation is a renaming of Base.Operation. Yes. Sorry about that. In my haste to covert what I had to a reduced example I forgot to make it null in the visible part. I would normally only hide that for private types. > > > I'm also not > > sure the semantics between the method I wanted and the > > method I had to use are the same (in all situations). > > No, with a direct renaming, a call to the renaming is the same as a call to the > original procedure. With a wrapper around the call to the original procedure, > you have 2 calls. If you inline the wrapper then they should be equivalent. I thought I remembered reading in the RM somewhere that if a renaming was a completion, that it was equivalent to a wrapper, but to be honest my memory isn't great. And even if I remembered correctly, I may not have understood the context of that fully. > > > 1. Is there a way to make the full view of a private type > > a subtype when the partial view is not a subtype? Or am > > I forced to derive a new type? > > You cannot use a subtype to complete a private type. But you're not forced to > use a derived type and convert all over the place. Another option is > > private > type T is [tagged] [limited] record > V : Base.T; > end record; > > and then refer to Object.V with no conversions. > Thanks! I didn't even think about nesting it like that. That'll work.