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: buffer1.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!goblin2!goblin.stu.neva.ru!reality.xs3.de!news.jacob-sparre.dk!loke.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Why does `Unchecked_Deallocation` need the access type? Date: Tue, 28 Jul 2015 16:25:19 -0500 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <5d6faxxdsssv.15g7kj5hv86mk$.dlg@40tude.net> <170ajsv4tazu3.mgrs0or8en9w$.dlg@40tude.net> NNTP-Posting-Host: rrsoftware.com X-Trace: loke.gir.dk 1438118721 16562 24.196.82.226 (28 Jul 2015 21:25:21 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Tue, 28 Jul 2015 21:25: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: number.nntp.giganews.com comp.lang.ada:194409 Date: 2015-07-28T16:25:19-05:00 List-Id: "Dmitry A. Kazakov" wrote in message news:170ajsv4tazu3.mgrs0or8en9w$.dlg@40tude.net... > 3. Tagged hierarchies > > type S is new T with private; > > S'Parent (T'Class) = T (in a public context) > > The argument indicates the hierarchy where to search for the ancestor (due > to MI). We tried such an attribute sometime during the Ada 2005 work and eventually gave up. The problem being that the parent (in a language sense - it's the subtype after "new") depends on the visibility on the type, and that is very unconfortable (besides causing problems): package P is type S is new T with private; procedure Bar (Obj : in out S'Parent); -- S'Parent is T here. private type S in new U with private; -- U is descended from T, of course. end P; package body P is procedure Bar (Obj : in out S'Parent) is -- !! - S'Parent is U here. ... end P; The body of Bar does not conform with the specification as S'Parent means something different in the two locations. That potentially includes having different operations available (Imagine if U has a function Foo that T does not have.), so there is a potential for a real problem. Eventually we added a function Parent_Tag in Ada.Tags; since it's runtime it ignores privacy and thus it has a unique value. I think you are using "Parent" in your write-up as what Ada calls a direct ancestor - that includes the parent (if any) and any progenitors. That's a different problem -- at least hiding interfaces isn't allowed so the visibility problem doesn't come up for progentitors. (Of course, if we ever did full MI, it would come back with a vengance.) Randy.