comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Overloading operator "=" for anonymous access types?
Date: Mon, 14 Jan 2019 17:08:32 -0600
Date: 2019-01-14T17:08:32-06:00	[thread overview]
Message-ID: <q1j4pi$2h0$1@franka.jacob-sparre.dk> (raw)
In-Reply-To: 0c56d9f4-8861-4c74-b170-a973e3789b08@googlegroups.com

<daicrkk@googlemail.com> 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.


  reply	other threads:[~2019-01-14 23:08 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-11 21:46 Overloading operator “=” for anonymous access types? daicrkk
2019-01-12  9:50 ` Simon Wright
2019-01-12 14:01   ` Simon Wright
2019-01-12 15:15   ` daicrkk
2019-01-14 23:08     ` Randy Brukardt [this message]
2019-01-15  0:34       ` Overloading operator "=" " Shark8
2019-01-15  8:38       ` Dmitry A. Kazakov
2019-01-15 21:00         ` Randy Brukardt
2019-01-16 15:42           ` Dmitry A. Kazakov
2019-01-15  8:51       ` daicrkk
2019-01-15 11:15         ` Simon Wright
2019-01-17  3:20       ` Jere
2019-01-17  8:23         ` Dmitry A. Kazakov
2019-01-17 22:22         ` Randy Brukardt
2019-01-18 10:17           ` Dmitry A. Kazakov
2019-01-18 13:27           ` Jere
2019-01-18 13:42             ` Dmitry A. Kazakov
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox