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,29523eff834b8169 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!feeder1-2.proxad.net!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Warnings about hiding 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: <44e7dff1-04f5-46ad-8521-e4fe030c9c29@26g2000yqv.googlegroups.com> Date: Sat, 9 Oct 2010 10:08:17 +0200 Message-ID: <1xqrjypkemc0w.18vlm9jb6pfpm$.dlg@40tude.net> NNTP-Posting-Date: 09 Oct 2010 10:08:14 CEST NNTP-Posting-Host: c943e95a.newsspool2.arcor-online.net X-Trace: DXC==FmTVjoRdd[f8j24CD<3lPA9EHlD;3YcR4Fo<]lROoRQ8kF On Sat, 9 Oct 2010 01:51:47 -0500, Randy Brukardt wrote: > "Vinzent Hoefler" wrote in message > news:op.vkabvkw30k3wt7@jellix.jlfencey.com... > ... >> JFTR: If you move "Finalize" into the public part, the warning for it >> disappears (just tested with GNAT GPL 2010). >> >> (IMO, there's no point putting it in the private part, the operation >> is already known, anyway.) > > My opinion is exactly the reverse: there is no point in putting it in the > visible part in this case -- it should not matter to clients whether or not > the subprogram is overridden, so why burden them with it?? It does matter: 1. Clients dealing with specific types shall be able to call manifested operations of the type. 2. Clients which publicly derive from a parent type must call the parent's Finalize from their implementations of Finalize. > That assumes of course that the clients are smart enough (or have good > tools) which can show them what is actually inherited. In the absense of > that, you really have to override everything in the public part, whether you > want to or not, else no one will know that the operations even exist - no > one can figure out by hand what's inherited. (I vote for good tools. :-) I vote for language fixes: 1. Finalize in the role of a destructor shall not be callable at all 2. When overridden the parent's implementation of Finalize shall be called automatically. 3. Private overriding of a public interface shall be illegal. I.e. if Foo is a public operation of T then either so: type S is new T with private; overriding procedure Foo (X : T); or else so: type S is private; private type S is new T with ...; overriding procedure Foo (X : T); -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de