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,a6449b2443dcdda1 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!feeder.news-service.com!news.albasani.net!nuzba.szn.dk!news.jacob-sparre.dk!pnx.dk!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Access keyword Date: Wed, 30 Apr 2008 18:40:43 -0500 Organization: Jacob's private Usenet server Message-ID: References: <2cc577f4-704a-4235-aad4-a29186309c02@k10g2000prm.googlegroups.com> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: jacob-sparre.dk 1209598900 1639 69.95.181.76 (30 Apr 2008 23:41:40 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Wed, 30 Apr 2008 23:41:40 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1914 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1914 Xref: g2news1.google.com comp.lang.ada:21156 Date: 2008-04-30T18:40:43-05:00 List-Id: "Adam Beneschan" wrote in message news:2cc577f4-704a-4235-aad4-a29186309c02@k10g2000prm.googlegroups.com... > On Apr 30, 12:15 am, Maciej Sobczak wrote: ... > > Anonymous access types are used by Ada.Containers for iteration (among > > others). "Rationale" by Barnes presents some nice examples with > > downward closures as well. > > I suspect that Randy was talking only about anonymous access-to-object > parameters. Those aren't used by the language's definition of > Ada.Containers, or at least I didn't spot any. > > Anonymous access-to-subprogram parameters (which Ada.Containers does > use) are a different animal altogether. They do serve a legitimate > purpose; downward closures are important but couldn't be done > satisfactorily in Ada 95. I agree with this, although the syntax is rotten. Anonymous-access-to-subprogram parameters have special semantics and cannot be stored (you'll get an accessibility error if you try). So they act like parameters that are subprograms rather than an access type. I think the syntax is rotten because these are access types only in the sense that a compiler will implement them this way. I do include regular anonymous-access-to-subprogram types in the category of useless features. And I do plead guilty to not opposing the expansion of this misfeature in the Amendment hard enough. I was temporarily swayed by arguments that they would allow using far fewer useless type conversions. The problem is that in practice it is not true: you still need type conversions unless you purge all of your named access types from the program. But then you lose the ability to have storage pools -- a nasty trade-off. Essentially, they don't provide the feature that was advertised, and thus should never have been approved. Beyond that, I agree with Dmitry that Ada needs a real iterator construct; passing a subprogram into another subprogram is much less understandable than for Element in Container loop ... end loop; And that would eliminate much of the need for "downward closures". (But not all! I don't want to get into a silly argument about that...) Randy.