comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Class-wide types algebra
Date: Wed, 28 Sep 2016 09:31:59 +0200
Date: 2016-09-28T09:31:59+02:00	[thread overview]
Message-ID: <nsfrn6$ab7$1@gioia.aioe.org> (raw)
In-Reply-To: nsf1g3$1jb$1@franka.jacob-sparre.dk

On 28/09/2016 02:05, Randy Brukardt wrote:
> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message
> news:nr8rah$14gp$1@gioia.aioe.org...
>> ... E.g.
>>
>>    type Root_Stream_Type is ...
>>
>> OK, that was a mistake, it should have been
>>
>>    type Root_Stream_Interface is limited interface;
>>    type Root_Stream_Type is abstract new Root_Stream_Interface
>>       with private;
>
> We would have made the above change years ago if it wasn't severely
> incompatible.
>
>> With T'Interface you could still work it around:
>
> But you'd still have the problem that interfaces can't be hidden (which is
> the source of the incompatibility). And lifting that restriction would be a
> nightmare (we've tried on several occasions), as you quickly get scenarios
> where you have to have two different copies of the same interface in order
> to keep sanity about the operations. (Else one has to totally abandon
> privacy, allowing hidden operations to be overridden. That leads to usage
> madness...)

That is largely because interfaces were introduced as named types, which 
was an error as well as introducing them at all.

T'Interface would be an anonymous type like T'Class is. There is no 
danger of having its copies because it is a by-structure thing and all 
copies are same.

> 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.

> 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. Use-clauses, nesting, generic formals have 
*exactly* same issues there is absolutely nothing special in inheritance.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

  reply	other threads:[~2016-09-28  7:31 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 [this message]
2016-09-28 20:17             ` Randy Brukardt
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