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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: border2.nntp.dca3.giganews.com!backlog4.nntp.dca3.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!feeder.erje.net!eu.feeder.erje.net!newsfeed.datemas.de!rt.uk.eu.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Strange error message Date: Mon, 2 Jun 2014 09:47:56 +0200 Organization: cbb software GmbH Message-ID: <17l7hex6vxkj4.wul0z12r7f85.dlg@40tude.net> References: <33e17033-615d-43d4-8b47-9357c8875a10@googlegroups.com> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: QTaafVZuunHujkJPndFR7g.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 X-Original-Bytes: 2711 Xref: number.nntp.dca.giganews.com comp.lang.ada:186699 Date: 2014-06-02T09:47:56+02:00 List-Id: On Sun, 01 Jun 2014 17:18:03 -0400, Robert A Duff wrote: > Charly writes: > >> when I defined a class hierarchy I encountered a problem, that I could reduce >> to the following few lines: >> >> This version compiles without problems: >> ----------------- >> package Test is >> >> type Base is tagged private; >> function Create return Base; >> >> type High is new Base with private; >> >> private >> >> type Base is tagged null record; >> >> type High is new Base with null record; >> >> end Test; > I don't know why Dmitry and Randy want us to write that out explicitly; > it seems like an obviously useful and safe default. The first objection is that the legality of inheriting Create in type Base is tagged private; function Create return Base; type High is new Base with private; depends on the private part of the package. This is not good. The second objection is, if the above is not good then type High is new Base with null record; should make no difference. --------------- Of course one could argue in favor of the rule that all primitive operations are in some sense overridden anyway. It is only the way the bodies are constructed (inherited vs. provided by the user), what makes difference. I.e. whether overriding function Create return High; appears in the public part of the package or not, that is an implementation detail uninteresting to the clients. I would agree with that, but it is not how the language is designed presently. It is, as always, too late, but probably overriding (with new body) were to appear strictly in the package body. Then the rule of null extension would be all OK to me. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de