comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: overriding in private part
Date: Fri, 3 Oct 2008 10:52:52 +0200
Date: 2008-10-03T10:52:52+02:00	[thread overview]
Message-ID: <hkj5r014m090$.8csbvkmmfqt4$.dlg@40tude.net> (raw)
In-Reply-To: 47e26a8d-d104-46c5-b841-667f6e556792@w7g2000hsa.googlegroups.com

On Thu, 2 Oct 2008 09:42:28 -0700 (PDT), Adam Beneschan wrote:

> In general, the language doesn't want to take private declarations of
> the parent into account when deciding whether something is
> overriding.

This is OK, but the problem is that the operation is formally considered
private when it is obviously (in common sense) not.

> Your case is a little more confusing because, like the above example,
> there's an invisible P2 operation of the parent type that shouldn't
> affect the behavior, but this is inherited from a P2 operation of the
> *grandparent* type that *is* visible in the private part of A1.A3.
> Perhaps the compiler should generate a warning about the possible
> confusion in this case.  If we didn't have an "overriding" keyword, I
> might even go so far as to suggest the language should make this case
> illegal, in order to prevent this kind of case from coming up.

It is not the overriding which must be illegal. The opposite should. I mean
it should be:

   overriding procedure P2 (X : Child); -- Legal (presently illegal)
   not overriding procedure P2 (X : Child); -- Illegal (presently legal)

> But
> since "overriding" has been added, you should just use it, and it will
> solve the problem.

Unfortunately it does not. The programmer desired to override P2, and this
is impossible to do, because there is a type in between which effectively
*hides* the operation in all packages, regardless their visibility.
Further, this behavior changes when the offending type is derived in A1
rather than in A1.A2. In that case A1.A3 would be able to override P2.

This is obviously broken to me.

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



  reply	other threads:[~2008-10-03  8:52 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-02 15:49 overriding in private part Maxim Reznik
2008-10-02 16:42 ` Adam Beneschan
2008-10-03  8:52   ` Dmitry A. Kazakov [this message]
2008-10-03 15:54     ` Adam Beneschan
2008-10-03 20:29       ` Robert A Duff
2008-10-04  2:28         ` Randy Brukardt
2008-10-04 19:47           ` Robert A Duff
2008-10-05  7:35             ` Dmitry A. Kazakov
2008-10-05 19:57               ` Robert A Duff
2008-10-06  8:50                 ` Dmitry A. Kazakov
2008-10-06 23:32                   ` Randy Brukardt
2008-10-05 11:46             ` stefan-lucks
2008-10-05 20:08               ` Robert A Duff
2008-10-06 23:39                 ` Randy Brukardt
2008-10-02 23:17 ` 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