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!news.eternal-september.org!feeder.eternal-september.org!xmission!newsswitch.lcs.mit.edu!nntp.TheWorld.com!.POSTED!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Anonymous access types are evil, why? Date: Fri, 30 Aug 2013 13:04:36 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <66f24ada-122c-4c01-9f04-5bc92233a456@googlegroups.com> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls7.std.com 1377882276 4605 192.74.137.71 (30 Aug 2013 17:04:36 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Fri, 30 Aug 2013 17:04:36 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:QOZzS4JPdkoBsRwutVUkAlHmtNM= Xref: news.eternal-september.org comp.lang.ada:17052 Date: 2013-08-30T13:04:36-04:00 List-Id: Adam Beneschan writes: > On Friday, August 30, 2013 12:29:17 AM UTC-7, ake.ragna...@gmail.com wrote: > >> Thanks for your analysis and especially the interesting result "an >> allocator whose type is a named access type should be preferred over >> an allocator whose type is anonymous". > > You're welcome, but I didn't mean for this to be taken as a general > rule of Ada programming. It looks like it's a helpful rule for this > particular implementation (GNAT 2013), but I still don't know whether > the implementation is correct or whether the extra overhead you're > seeing is actually necessary. It could be that this is a problem with > GNAT, and they'll fix it, and that in the future there may not be a > reason to prefer allocators whose types are named. I just don't know. I didn't look at the example -- I don't know if there's a GNAT bug or not. But I think "prefer named access types" is pretty good general advice. Anonymous access types have their uses, but they're pretty special purpose. "access T" is not just an innocuous shorthand for avoiding having to name the access type. Too bad. Access types are one of the few places where you usually want "by structure" type equivalence rather than "by name". - Bob