comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Overloading operator "=" for anonymous access types?
Date: Tue, 15 Jan 2019 15:00:31 -0600
Date: 2019-01-15T15:00:31-06:00	[thread overview]
Message-ID: <q1lhlg$38b$1@franka.jacob-sparre.dk> (raw)
In-Reply-To: q1k65j$1qqm$1@gioia.aioe.org

"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message 
news:q1k65j$1qqm$1@gioia.aioe.org...
...
> [ The reference manual is shy to say anything about it. It claims that 
> universal_access is kind of class-wide, which would mean, if taken 
> seriously, that "=" overloads and must clash with the original "=".

This is what happens. However, such a clash would mean that you could never 
write a user-defined "=" for an anonymous access type. That would have been 
a good idea, but it would have to have been enforced with a Legality Rule to 
be sensible. Some thought that bad because of compatibility, so...

> Since it does not, universal_access is more like a parent type than 
> class-wide.]

...there is a hack to have a preference for the user-defined one. That 
doesn't change the the fact that universal_access is class-wide, it just 
make it possible to write a user-defined operator.

>P.S. And, wouldn't it be better to fix the type system, no?

This wart would be one of the things that would make "fixing the type 
system" so much harder. A proper solution (and the one we should have used 
in the first place) is to declare a "=" for every access type. I think we 
wanted to avoid that as anonymous access can be declared in places where 
declarations aren't allowed, so we came up with something worse. :-)

It's the idea of anonymous access types that destroys the type system that 
you have in mind. Your system keeps the types and operations together, and 
that makes no sense for an anonymous type (what are the operations for an 
anonymous type, and where are they declared? Any answer is either magical or 
nonsense.)

One has to get rid of nonsense things before one could regularize the type 
system, especially upon the lines you have been suggesting for years. It's 
not really possible for Ada; you would end up with an Ada-like language.

                           Randy.



This is just another Ada 


  reply	other threads:[~2019-01-15 21:00 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     ` Overloading operator "=" " Randy Brukardt
2019-01-15  0:34       ` Shark8
2019-01-15  8:38       ` Dmitry A. Kazakov
2019-01-15 21:00         ` Randy Brukardt [this message]
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