From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!gandalf.srv.welterde.de!news.jacob-sparre.dk!loke.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Polymorphism Date: Thu, 7 May 2015 14:09:31 -0500 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <5hbl45anxasb.1jn73i00zgy2i.dlg@40tude.net> NNTP-Posting-Host: rrsoftware.com X-Trace: loke.gir.dk 1431025772 20785 24.196.82.226 (7 May 2015 19:09:32 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Thu, 7 May 2015 19:09:32 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Xref: news.eternal-september.org comp.lang.ada:25763 Date: 2015-05-07T14:09:31-05:00 List-Id: "Dmitry A. Kazakov" 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.