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,344faf475a6f812a X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit X-Received: by 10.66.189.195 with SMTP id gk3mr4976572pac.16.1367622596351; Fri, 03 May 2013 16:09:56 -0700 (PDT) MIME-Version: 1.0 Path: ln4ni1292pbb.0!nntp.google.com!npeer01.iad.highwinds-media.com!feed-me.highwinds-media.com!cyclone01.ams2.highwinds-media.com!news.highwinds-media.com!voer-me.highwinds-media.com!eweka.nl!lightspeed.eweka.nl!193.141.40.65.MISMATCH!npeer.de.kpn-eurorings.net!npeer-ng0.de.kpn-eurorings.net!newsfeed.fsmpi.rwth-aachen.de!reality.xs3.de!news.jacob-sparre.dk!munin.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Interresting difference in Normal-Returns/Expression-Functions and Extended-Returns. Date: Fri, 3 May 2013 18:09:52 -0500 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <97967083-d21d-4de2-aeb8-76d0d5818993@googlegroups.com> <03e84773-d616-4a46-8189-93ae4ab5fcbf@googlegroups.com> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1367622595 20330 69.95.181.76 (3 May 2013 23:09:55 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Fri, 3 May 2013 23:09:55 +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 X-Received-Bytes: 3696 Date: 2013-05-03T18:09:52-05:00 List-Id: "Adam Beneschan" wrote in message news:e7ef987b-3fdb-4b59-bfd5-918006cf1ce2@googlegroups.com... ... >I still think that anonymous access types should only be used when >necessary, >since there are special accessibility level rules for anonymous access >types that >have some surprising consequences. There may be cases where it's >beneficial >to take advantage of those special rules. It might be useful to know that the accessibility of an anonymous access return type is the same as that of an access discriminant returned from a function. And this is what provides the "value" of these things: the user-defined dereferencing is built on access discriminants simply because they already had the correct accessibility. So we were able to get what we wanted (a very short-lived access value that can be dereferenced but cannot be copied in most circumstances) without inventing new rules. This is where we put up the disclaimer (a-la Mythbusters): "Do not try this at home! The ARG are trained professionals and they barely know what they're doing! :-)" > But one should not use anonymous access types just because "hey, Ada >lets us do it now and I can just throw in a pointer without having to think >up >a type name, like C programmers get to do!". A good rule might be "don't >use >anonymous access types unless you've read 3.10.2 and understand it >thoroughly." >(OK, that was a joke.) This is generally good advice. There are a lot of different kinds of anonymous access types and they all act different; unless you know what your doing, you're going to get it wrong. For instance, the anonymous access type (AAT) of a component has the accessibility of the enclosing type (usually static); AAT of parameters is fully dynamic; AAT of a stand-alone object is almost fully dynamic (they don't allow shorter lifetimes), AAT of a function result depends on the point of call, and AAT of a discriminant depends on where it is used, including all of the above. There is a good reason that 3.10.2 is known within the ARG as the "Heart of Darkness". :-) [This is now mentioned in the AARM: 3.10.2(3.b/3).] Randy. -- Adam