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!news.eternal-september.org!feeder.eternal-september.org!nntp-feed.chiark.greenend.org.uk!ewrotcd!newsfeed.xs3.de!io.xs3.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Getting the index for an element in mutually referencing containers Date: Mon, 13 Mar 2017 14:55:09 -0500 Organization: JSA Research & Innovation Message-ID: References: <86o9xa36oq.fsf@gaheris.avalon.lan> <86k27xpikd.fsf@gaheris.avalon.lan> <86wpbxneuz.fsf@gaheris.avalon.lan> NNTP-Posting-Host: rrsoftware.com X-Trace: franka.jacob-sparre.dk 1489434910 871 24.196.82.226 (13 Mar 2017 19:55:10 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Mon, 13 Mar 2017 19:55:10 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Response X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Xref: news.eternal-september.org comp.lang.ada:29121 Date: 2017-03-13T14:55:09-05:00 List-Id: "Dmitry A. Kazakov" wrote in message news:oa41a4$1ko5$1@gioia.aioe.org... > On 2017-03-12 17:44, Simon Wright wrote: ... > P.S. It is a pity that Implicit_Dereference type does not have proper > interface to work with *any* type instead of discriminated records. This > is design fault when the use case #2 was taken for #1. It works with any type, since the real target type is the thing designated by the discriminant. The discriminant is the key, because it is the only way in Ada to get an access type with a controlled lifetime. The discriminated type is just a helper, not the end result. Yes, we could have done that some other way, and indeed we started with a separate construct, but the semantics ended up identical to that of an access discriminant of a controlled type -- so why build another construct (with all of the additional chances of getting it wrong) when an existing one will do? Syntax sugar covers up the mess in almost all uses - and that's a lot easier to define correctly. Randy.