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.36.189.131 with SMTP id x125mr753843ite.37.1513646525864; Mon, 18 Dec 2017 17:22:05 -0800 (PST) X-Received: by 10.157.81.193 with SMTP id d1mr59518oth.13.1513646525798; Mon, 18 Dec 2017 17:22:05 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!news.kjsl.com!usenet.stanford.edu!i6no115103itb.0!news-out.google.com!b73ni307ita.0!nntp.google.com!i6no115102itb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 18 Dec 2017 17:22:05 -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: <5b32a99e-04e5-4adb-8b42-88e485570641@googlegroups.com> <83982113-349e-4443-b457-e63d749ad42a@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Full view of a private partial view cannot be a subtype From: Jere Injection-Date: Tue, 19 Dec 2017 01:22:05 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader02.eternal-september.org comp.lang.ada:49531 Date: 2017-12-18T17:22:05-08:00 List-Id: On Monday, December 18, 2017 at 5:47:51 PM UTC-5, Randy Brukardt wrote: > "Dmitry A. Kazakov" wrote in message > > On 2017-12-17 16:26, Jere wrote: > > > >> my assertion is that: > >> > >> subtype Thing is Core_Pkg.Thing; > >> > >> procedure Do_Something(The_Thing : in out Thing) > >> renames Core_Pkg.Do_Something; > >> is easier to both maintain and read than: > >> > >> type Thing is new Core_Pkg.Thing with null record; > >> procedure Do_Something(The_Thing : in out Thing); > > > > But these are two semantically different concepts. Ada's subtype declares > > an equivalent type [it inherits everything from and exports everything to > > the base]. Ada's new tagged type declares a new instance of a class. It > > only inherits. > > > > I don't understand how can you exchange one for another. > > You can't really; they're very different concepts. The OP is showing a > confusion, because the renames he wants is perfectly legal, assuming proper > visibility. And if the items in question are private, then he is trying to > make a privacy leak -- which the language will not make easy for obvious > reasons. > > Randy/ I'm not really trying to make a privacy leak on purpose. I'm just trying to provide a simpler interface to a much more complex and dangerous generic so that someone doesn't accidentally use something they shouldn't. Any privacy leaks are not intentional. I was just asking a question. Using either extension, derivations, or composition all seemed very heavy handed for just wanting to mimic the same specification as another generic. Subtypes and renames expressed exactly the relationship I wanted, but the only thing I couldn't do was hide a deallocation operation that should never be called directly (it was an input to the base generic). That one items is what got me to this question. I wanted to see if there was a way to keep the subtype/rename method while hiding the operation and the answer looks to be no. But I wasn't sitting around twiddling my fingers looking for ways to break Ada privacy in the process. I just wanted to understand if there was a way and if not, why. That's all, nothing nefarious on my part, at least not intentionally.