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.44.197 with SMTP id s188mr8512421pgs.61.1495327861625; Sat, 20 May 2017 17:51:01 -0700 (PDT) X-Received: by 10.157.45.132 with SMTP id g4mr349832otb.0.1495327861580; Sat, 20 May 2017 17:51:01 -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!67no1036627itx.0!news-out.google.com!m134ni4349itb.0!nntp.google.com!67no1036626itx.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sat, 20 May 2017 17:51:01 -0700 (PDT) In-Reply-To: <4a47e4cd-829c-4451-abf1-82cf60b67706@googlegroups.com> 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> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <0efda5a1-b674-4632-8728-4586b52b8d34@googlegroups.com> Subject: Re: Preventing private procedure visibility being made public through extension From: Jere Injection-Date: Sun, 21 May 2017 00:51:01 +0000 Content-Type: text/plain; charset="UTF-8" Xref: news.eternal-september.org comp.lang.ada:46829 Date: 2017-05-20T17:51:01-07:00 List-Id: On Saturday, May 20, 2017 at 6:51:43 PM UTC-4, Jere wrote: > On Saturday, May 20, 2017 at 4:32:07 PM UTC-4, Dmitry A. Kazakov wrote: > > On 2017-05-20 19:33, Jere wrote: > > > Is there a way for me to prevent extending types from making > > > the procedure public again? > > > > It is public. That was the decision made in the package Base. The > > package Derived has no say on that. > > > > ---------------------------------- > > The actual problem you have is parallel types hierarchies. You want to > > derive tied instances of Base_Type'Class and Base_Param'Class. > > > > Base_Type ----- Base_Param > > | | > > Derived_Type -- Derived_Param > > > The actual use case is Gnoga. All of the constructors > (the Create procedures) require parent to be of type > Gnoga.Gui.Base.Base_Type'Class, but I really want my > Dialog_Type constructor to only accept parents of type > Gnoga.Gui.Window.Window_Type'Class. But it also has > to publicly extend Gnoga.Gui.Base.Base_Type > (or I use Gnoga.Gui.View.View_Base_Type) so that > other controls can create themselves in it. This > opens my type and types that extend it to being > thrashed by calls to Create_From_HTML and so on. > Similar to your suggestion, I can override them and > raise an exception...it just feels clunky. > Or perhaps if Ada supported constructors that were not dispatchable and that were not inherited that might also work. I would need to think about it a bit to be sure about that though. Just an off the cuff thought.