From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Polymorphism
Date: Thu, 7 May 2015 14:09:31 -0500
Date: 2015-05-07T14:09:31-05:00 [thread overview]
Message-ID: <migd9c$k9h$1@loke.gir.dk> (raw)
In-Reply-To: 5hbl45anxasb.1jn73i00zgy2i.dlg@40tude.net
"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message
news:5hbl45anxasb.1jn73i00zgy2i.dlg@40tude.net...
...
> I don't know why it is not allowed.
It *is* allowed. The problem in the OPs case is that the routine was
abstract. Abstract routines must be overridden, but if it is private a
client can't know that. Moreover, a client *cannot* override a private
operation, so there could be no client in that case. Thus the original
declaration is illegal.
As Simon pointed out, if the operation is concrete, it is fine to put it
there. Then all clients that need to override it have to be child packages.
Claw uses this extensively.
> Moreover, it probably would make sense
> to move all declarations of overriding into private
This is my coding standard. I only put new stuff into the visible part.
> or even further into the package body
That's not allowed as the tag has to be known when the type is frozen (that
is, at the end of the specification). Of course, it would be possible to
have a different set of rules where the tag isn't known at that point, but
that's not the Ada design.
> because the fact of overriding is mere an implementation
> detail, since the primitive subroutine is there anyway no matter what.
Correct; that's why I put them into the private part.
Randy.
next prev parent reply other threads:[~2015-05-07 19:09 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-06 23:05 Polymorphism slos
2015-05-07 7:28 ` Polymorphism Simon Wright
2015-05-07 8:32 ` Polymorphism slos
2015-05-07 7:41 ` Polymorphism Dmitry A. Kazakov
2015-05-07 8:34 ` Polymorphism slos
2015-05-07 19:09 ` Randy Brukardt [this message]
2015-05-11 22:05 ` Polymorphism slos
2015-05-12 1:29 ` Polymorphism Randy Brukardt
2015-05-14 21:34 ` Polymorphism slos
-- strict thread matches above, loose matches on Subject: below --
1996-11-25 0:00 polymorphism W. Wesley Groleau (Wes)
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox