comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Class-wide types algebra
Date: Wed, 28 Sep 2016 15:17:17 -0500
Date: 2016-09-28T15:17:17-05:00	[thread overview]
Message-ID: <nsh8fn$4li$1@franka.jacob-sparre.dk> (raw)
In-Reply-To: nsfrn6$ab7$1@gioia.aioe.org

"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message 
news:nsfrn6$ab7$1@gioia.aioe.org...
> On 28/09/2016 02:05, Randy Brukardt wrote:
...
>> The problem with all forms of MI is diamond inheritance, which get much
>> worse in Ada because of our strict privacy rules.
>
> There is no any problems with diamond inheritance and visibility.

Certainly are. If one has a hidden interface with hidden overridden 
operations, and a later extension tries to add the same interface with 
different overridden operations, one of two things has to happen, both bad:
(1) The interfaces are the same, so the hidden operations completely 
disappear. (The new extension cannot know that they ever existed, so they 
cannot be called from it.) Since the parent operation presumably depends on 
those operations, trouble is certain to ensue. (When the operations aren't 
overridden, then they magically become visible, which is also a problem.)
(2) The interfaces are different, so one has problems in dispatching calls 
of figuring out which one to call. That way leads to madness.

The problem here is that only (2) respects privacy at all; (1) eliminates it 
no matter how the conflict is resolved (the fact that the parent has a 
hidden interface changes the semantics of the extension even though the 
extension is not supposed to know or care about the interface).

>> I don't think that could
>> ever be solved for Ada (perhaps a new language could solve it, but not 
>> Ada).
>
> It can easily be solved once understood that inheritance may produce 
> conflicts to be resolved by the programmer, not by the language, which is 
> indeed impossible.

The programmer can't resolve the conflicts unless privacy is ignored, 
because the programmer has no knowledge that the hidden interface is used. 
So why shouldn't they be able to use the same interface?? Any answer breaks 
privacy badly.

Remember, the case in question is an extension from a private view, for 
which no knowledge about the implementation should escape.

> Use-clauses, nesting, generic formals have *exactly* same issues there is 
> absolutely nothing special in inheritance.

And all of those are also evil. :-) They introduce significant maintenance 
problems all of the time. And they don't have the problem of requiring 
visibility on private things to resolve the conflicts. (For all of the 
above, private things stay private.)

                            Randy.



  reply	other threads:[~2016-09-28 20:17 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-12 20:26 Class-wide types algebra Dmitry A. Kazakov
2016-09-12 21:12 ` rieachus
2016-09-12 21:39   ` Dmitry A. Kazakov
2016-09-13 11:46     ` rieachus
2016-09-13 12:26       ` Dmitry A. Kazakov
2016-09-28  0:05         ` Randy Brukardt
2016-09-28  7:31           ` Dmitry A. Kazakov
2016-09-28 20:17             ` Randy Brukardt [this message]
2016-09-29  8:06               ` Dmitry A. Kazakov
2016-09-29 18:44                 ` Randy Brukardt
2016-09-29 19:55                   ` Dmitry A. Kazakov
2016-10-01  5:47                     ` Randy Brukardt
2016-10-01  8:35                       ` Dmitry A. Kazakov
2016-10-05 20:42                         ` Randy Brukardt
replies disabled

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