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: a07f3367d7,67bb3e29a77c25c6 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!postnews.google.com!20g2000prg.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: pragma Pure (Ada) Date: Mon, 10 Oct 2011 08:06:26 -0700 (PDT) Organization: http://groups.google.com Message-ID: <02d770c9-8e80-45a9-aa40-fc38215a12af@20g2000prg.googlegroups.com> References: NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1318259285 27520 127.0.0.1 (10 Oct 2011 15:08:05 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 10 Oct 2011 15:08:05 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: 20g2000prg.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-Header-Order: ARLUEHNKC X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; WOW64; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618; .NET4.0C),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:21350 Date: 2011-10-10T08:06:26-07:00 List-Id: On Oct 8, 3:54=A0pm, Yannick Duch=EAne (Hibou57) wrote: > Le Sat, 08 Oct 2011 03:37:53 +0200, Adam Beneschan a = =A0 > =E9crit:> So a special rule had to be added to make the language *prefer*= the > > "universal access" equality function over any other function. > > > Hope this helps, > > Yes Adam, that help, but raise another question: the choice of the =A0 > anonymous access type operator is surprising to me. Why was the choice of= =A0 > the more specific operator rejected ? I guess this may be because the = =A0 > anonymous access type may not always be a valid parameter for the more = =A0 > specific redefined operator of the named access type (ex. different =A0 > storage pool), but the choice of the least specific operator, is =A0 > counterintuitive, Actually, I think the opposite is true. Say you have a package that defines a record type Rec1 which defines an element of a linked list, and it has a Link field: Link : access Rec1; Now, in another package P2, you have some reason for defining your own access type that accesses Rec1. Maybe it's declared as a private type: type Employee is private; but you decide to implement it as an access-to-Rec1, in the private part: type Employee is access all Rec1; If we followed the rule you say is "intuitive", then any time in the body of P2, you wrote if A.Link =3D B.Link then ... the Link fields would suddenly be treated as having type Employee (because the "=3D" operator on Employee would be used), even though Link wasn't declared as having type Employee and the Employee type wasn't even visible at the point the Link was declared. This, to me, is counter-intuitive. So I think you've gotten it backwards. The example is somewhat contrived; it's hard for me to think of a good real-life example. In practice, "=3D" won't be redefined that often, which means it really doesn't matter which one the compiler picks. You're going to be comparing two addresses for equality, no matter which one is picked. But there have to be some rules to allow the compiler to pick one. And, as Niklas pointed out, if there are multiple named access types visible that access the same designated type, using the "more specific" operator would still produce ambiguous errors, which is not desired. -- Adam