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=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,7009541db2ced1ad X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!news3.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!oleane.net!oleane!news.ecp.fr!news.jacob-sparre.dk!pnx.dk!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Construction initialization problem Date: Fri, 5 Dec 2008 19:47:53 -0600 Organization: Jacob Sparre Andersen Message-ID: References: NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1228528108 2923 69.95.181.76 (6 Dec 2008 01:48:28 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Sat, 6 Dec 2008 01:48:28 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5512 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 Xref: g2news2.google.com comp.lang.ada:3870 Date: 2008-12-05T19:47:53-06:00 List-Id: "Adam Beneschan" wrote in message news:b5578996-6595-499c-8031-3bfae82a6070@s9g2000prm.googlegroups.com... ... > I thought access discriminants---at least those with anonymous access > type---were put into Ada 95 (before there were coextensions) to allow > objects to point to other objects in a nested scope, in a restricted > way (i.e. only in limited types) that prevented those references to a > nested objects from staying around after the nested object > disappeared. There always were coextensions in Ada 95; they just didn't have that name. You might be right about the original reason, but like everything else about anonymous access types, it doesn't work in practice. Best thing to do with them is to forget that they exist. > I wasn't aware that there were enough new features in > Ada 2005 to provide this ability without using access discriminants. > So what am I missing? I don't think this capability is (usefully) provided in Ada 95, either, because you don't want these things to be discriminants - that triggers all kinds of other rules (such as the requirement to use full record aggregates) that get in the way more than help. Coextensions probably are the only way to do this usefully, but they're very complex to implement and understand, and people don't use them anyway because they *look* like dynamic allocation (even though they are not supposed to be implemented that way). This is the sort of thing that looks good in toy examples, but falls apart when you actually try to use it (as Dmitry noted in his original question). Randy.