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,12c1e4936587932e X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!eweka.nl!lightspeed.eweka.nl!npeer.de.kpn-eurorings.net!npeer-ng1.kpn.DE!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: overriding in private part 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: <45b4a4cc-13f5-4175-9061-9c962e32d762@64g2000hsm.googlegroups.com> <47e26a8d-d104-46c5-b841-667f6e556792@w7g2000hsa.googlegroups.com> <1vlrayvqx3imy.cp250cnppen5.dlg@40tude.net> Date: Mon, 6 Oct 2008 10:50:04 +0200 Message-ID: <16aosnc43o0l2.1snh410eman0v$.dlg@40tude.net> NNTP-Posting-Date: 06 Oct 2008 10:50:04 CEST NNTP-Posting-Host: 780619fe.newsspool4.arcor-online.net X-Trace: DXC=dB]oBbfJZg>^cW`WBF>WQ<4IUK7enW;^6ZC`4IXm65S@:3>?ad5j8V?iYP; X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:2247 Date: 2008-10-06T10:50:04+02:00 List-Id: On Sun, 05 Oct 2008 15:57:48 -0400, Robert A Duff wrote: > "Dmitry A. Kazakov" writes: > >> On Sat, 04 Oct 2008 15:47:04 -0400, Robert A Duff wrote: >> >>> If you use a compiler that warns on missing "overriding", then you don't >>> need to say "not overriding", because that's the default -- any >>> subprogram that doesn't say "overriding" is not overriding. >>> Saying "not overriding" is just noise. >> >> [...] >> >>> I agree that if you want an indicator on every subprogram declaration, >>> then forbidding "no overriding" on some non-overriding subprograms is a >>> language design mistake. But I don't want that -- I want a safe >>> (non-overriding) default. >> >> But non-overriding is unsafe. Taking your example with in and in-out, when >> the programmer uses in instead of in-out, that does not change the program >> semantics, so long the program remains legal. Otherwise (if the body >> actually changes the parameter) it will not compile. This is safe. > > Good point, but I'm only half convinced. If you get in the habit of > always saying "overriding" when appropriate, and you use the warnings, > then you're unlikely to get into trouble. And the idea of putting "not > overriding" all over the place seems awfully verbose, to me. Both are unsafe. A felt verbosity comes from the strange decision to put [not] overriding in front of the declaration. If it were: procedure Foo (X : Boo) is not overriding; it would not be so offending. As for me, I think that overriding could be a good default for all subprograms with at least one controlling argument. Declarations of any new primitive operation should then be explicit: procedure Foo (X : Boo) is [abstract] new; -- I hate "overriding" Non-primitive operations should be made illegal if any of the arguments is controlling: type T is tagged ...; procedure Foo (X : T) is new; package Bar is procedure Foo (X : T); -- You cannot do this! procedure Baz (X : T); -- Neither this! procedure Baz (X : T'Class); -- This is OK end Bar; Maybe, that could be relaxed the bodies of the packages which specifications declare the type: package A is type X is tagged ...; end A; package body A is procedure Some_Private_Stuff_Without_Redispatch (X : T) is not new; end A; -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de