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 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!gandalf.srv.welterde.de!news.jacob-sparre.dk!loke.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Ada design bug or GNAT bug? Date: Sat, 4 Jul 2015 19:53:20 -0500 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <4lrj5zz2u2z.u8x9cf7xzic6.dlg@40tude.net> <1oyc7ksu2lrwz.1h4pqchzcyfzt.dlg@40tude.net> <56pbwdnfce0k$.5et1apcv65k9.dlg@40tude.net> <1myo335gjwyy3$.1bthq0cugahll.dlg@40tude.net> NNTP-Posting-Host: rrsoftware.com X-Trace: loke.gir.dk 1436057601 31967 24.196.82.226 (5 Jul 2015 00:53:21 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Sun, 5 Jul 2015 00:53:21 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Xref: news.eternal-september.org comp.lang.ada:26617 Date: 2015-07-04T19:53:20-05:00 List-Id: "Dmitry A. Kazakov" wrote in message news:1myo335gjwyy3$.1bthq0cugahll.dlg@40tude.net... > On Fri, 3 Jul 2015 22:11:18 -0500, Randy Brukardt wrote: ... >> But of course that breaks privacy: T4 knows nothing about the full type >> of >> T3 or any private operations it may have. > > There are a lot of other cases where you effectively unable to derive from > a type. Since they are not counted privacy breach, this one shouldn't > either. There are? I can't think of any. Ada 95 had an accessibility check, but that's gone in more recent versions of the language. Of course, I hardly ever use derived types other than for extension. Like interfaces, the other uses come up so rarely that they aren't worth worrying about. So I may have just forgotten something. > In my view the problem is not in T4 but in T3, like in all other cases > when > you would not be able to derive later. So my solution would be a mandatory > declaration of the public view as final. E.g. > > package P2 is > type T3 is new T1 with private; -- Illegal, no derived types possible > private > type T3 is new T2 with null record; > end P2; > > package P2 is > type T3 is new T1 with private > with Childless => True; -- Legal, this is the last public descendant > private > type T3 is new T2 with null record; > end P2; > > Now, T4 cannot claim knowing nothing. Fine idea for Ada 9x, but way too late nowdays. We're not going to break 50% of the existing Ada code... Randy.