From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Warnings about hiding
Date: Sat, 9 Oct 2010 10:08:17 +0200
Date: 2010-10-09T10:08:14+02:00 [thread overview]
Message-ID: <1xqrjypkemc0w.18vlm9jb6pfpm$.dlg@40tude.net> (raw)
In-Reply-To: i8p3e5$pdl$1@munin.nbi.dk
On Sat, 9 Oct 2010 01:51:47 -0500, Randy Brukardt wrote:
> "Vinzent Hoefler" <nntp-2010-10@t-domaingrabbing.de> 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
next prev parent reply other threads:[~2010-10-09 8:08 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-08 12:47 Warnings about hiding Julian Leyh
2010-10-08 19:46 ` Adam Beneschan
2010-10-08 20:24 ` Simon Wright
2010-10-09 1:31 ` Vinzent Hoefler
2010-10-09 6:51 ` Randy Brukardt
2010-10-09 8:08 ` Dmitry A. Kazakov [this message]
2010-10-26 1:34 ` Yannick Duchêne (Hibou57)
2010-10-26 1:28 ` Yannick Duchêne (Hibou57)
2010-10-09 11:18 ` anon
2010-10-09 19:11 ` Simon Wright
2010-10-09 20:11 ` anon
2010-10-26 1:16 ` Yannick Duchêne (Hibou57)
2010-10-26 9:32 ` J-P. Rosen
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox