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!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.rrsoftware.com!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Overloading operator "=" for anonymous access types? Date: Mon, 14 Jan 2019 17:08:32 -0600 Organization: JSA Research & Innovation Message-ID: References: <167dc83d-daac-49eb-ba79-48866ccde39d@googlegroups.com> <0c56d9f4-8861-4c74-b170-a973e3789b08@googlegroups.com> Injection-Date: Mon, 14 Jan 2019 23:08:35 -0000 (UTC) Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226"; logging-data="2592"; mail-complaints-to="news@jacob-sparre.dk" X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246 X-RFC2646: Format=Flowed; Original Xref: reader01.eternal-september.org comp.lang.ada:55276 Date: 2019-01-14T17:08:32-06:00 List-Id: wrote in message news:0c56d9f4-8861-4c74-b170-a973e3789b08@googlegroups.com... >I second that. Access Cell is an access-to-object type whose designated >type is Cell (check), Cell has a user-defined primitive equality operator >(check) such that its result type is Boolean (check), it is declared >immediately within the same declaration list as Cell (check), at least one >of its operands is an access parameter with designated type Cell (both >operands are, check). >According to 4.5.2, universal_access "=" should never be allowed to kick in >at all here, not even with "L = null". Or am I missing something? Yup, I agree with this. My first thought when reading that example is that it is wrong, because I don't remember anywhere in Ada where the same operator with arguments of the same type means different things. I don't think the use of "null" could change that. Dunno if John wrote that for a different version of Ada, or he was just confused by a rule that barely makes sense anyway. As always, best avoid anonymous access types unless you have to use one of their special features (dynamic accessibility, dispatching, special discriminant accessibility, or closures [for access-to-subprograms]). And better still, lets lobby to get those special features optionally available for named access types so no one every has to use an anonymous anything. :-) Randy.