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 X-Google-Thread: 103376,21960280f1d61e84 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!news.tele.dk!feed118.news.tele.dk!news.tele.dk!small.news.tele.dk!lnewsinpeer00.lnd.ops.eu.uu.net!bnewsinpeer00.bru.ops.eu.uu.net!emea.uu.net!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: How come Ada isn't more popular? Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: Date: Sat, 10 Feb 2007 16:54:44 +0100 Message-ID: NNTP-Posting-Date: 10 Feb 2007 16:54:27 CET NNTP-Posting-Host: 4b722d24.newsspool4.arcor-online.net X-Trace: DXC= On Sat, 10 Feb 2007 08:22:59 -0500, Robert A Duff wrote: > "Dmitry A. Kazakov" writes: > >> On Fri, 9 Feb 2007 22:18:51 -0600, Randy Brukardt wrote: >> >>> Dmitry A. Kazakov writes: >>> ... >>>> Because it does not compose upon inheritance and aggregation. >>>> >>>> When inherited the constructing function need to be overridden, even if >>>> null record was the only thing added. >>> >>> That's not true in Ada 2007. (That's a change I strongly opposed, BTW, >>> because it makes prototyping much harder. I usually start an extension with >>> a null record, figure out what needs to be overridden (giving those null >>> bodies), and then implement the actual routines and data. This no longer >>> works, because as soon as you add an extension component you are back to >>> square one.) >> >> Yuck. Do I understand correctly, primitive operations are no more covariant >> in the result? >> >> type T is tagged ...; >> function Foo return T; >> >> type S is new T ...; >> -- I don't need to override Foo???? > > It depends what the "..." is. You don't need to override Foo if it's > "with null record", which is what you were wanting above ("even if ..."). No, I didn't mean that. "Even if" was related to the model where constructors were functions. This model is sometimes unnatural and the requirement to override constructing function is a consequence of this unnaturalness to me. As for covariant functions, IMO the initial Ada 95 design is absolutely correct, because whether a record was physically extended or not looks much like an implementation detail to me. [*] Constructors need not to be overridden when there is a way to generate them safely. Though, I must admit that the difference looks too subtle. --------- * Ideally, when deriving the programmer should be able to specify his intent: whether the new type is equivalent, a generalization (extension), a specialization (constraining) or both/neither. For generalization all primitive operations with out, in out parameters and results of the base type should be required to be overridden. For specialization all primitive operations with in and in out parameters should be overridden. For both everything need to be overridden. (for overriding with the same body one could provide some syntax sugar) -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de