comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: overriding in private part
Date: Fri, 3 Oct 2008 21:28:43 -0500
Date: 2008-10-03T21:28:43-05:00	[thread overview]
Message-ID: <gc6keh$7hv$1@jacob-sparre.dk> (raw)
In-Reply-To: wcc1vyxwhge.fsf@shell01.TheWorld.com

"Robert A Duff" <bobduff@shell01.TheWorld.com> wrote in message 
news:wcc1vyxwhge.fsf@shell01.TheWorld.com...
> Adam Beneschan <adam@irvine.com> writes:
>
>> I shouldn't have said "solve".  It *partially* solves the problem, in
>> that if the programmers use "overriding" and "not overriding"
>> consistently on everything, it won't let you write a program that has
>> an unexpected result of the sort Maxim ran into.
>
> I think you should say "overriding" wherever it's legal,
> but never say "not overriding".  And use a compiler that
> warns on missing "overriding" -- such as a recent GNAT
> with the -gnatyO switch.

I agree with Adam; after all, there is a reason that "not overriding" 
exists. I'm curious as to why you think it shouldn't be used. If you write a 
routine that you do not expect to override something, and it does anyway, 
you have a problem (because you could be called from a dispatching routine 
with a completely different purpose, and conceivably different preconditions 
and postconditions). I think you'd like to know about that problem.

There are cases where you can't use either indicator (where the overriding 
happens "late"), but those usually indicate a program structuring issue 
(routines are being hidden in the root types that ought to be visible, or 
the child types are making routines visible that should be private). And in 
such cases I think it is important to document why no indicator was given 
with a comment.

I wanted indicators to be allowed on all subprograms in order that I could 
enforce a rule of "no indicator" -> style violation, but that got voted down 
(they're only allowed on primitive subprograms). I still think that was a 
serious mistake (it's weird to have to leave out indicators on class-wide 
routines, for instance).

                                 Randy.





  reply	other threads:[~2008-10-04  2:28 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-02 15:49 overriding in private part Maxim Reznik
2008-10-02 16:42 ` Adam Beneschan
2008-10-03  8:52   ` Dmitry A. Kazakov
2008-10-03 15:54     ` Adam Beneschan
2008-10-03 20:29       ` Robert A Duff
2008-10-04  2:28         ` Randy Brukardt [this message]
2008-10-04 19:47           ` Robert A Duff
2008-10-05  7:35             ` Dmitry A. Kazakov
2008-10-05 19:57               ` Robert A Duff
2008-10-06  8:50                 ` Dmitry A. Kazakov
2008-10-06 23:32                   ` Randy Brukardt
2008-10-05 11:46             ` stefan-lucks
2008-10-05 20:08               ` Robert A Duff
2008-10-06 23:39                 ` Randy Brukardt
2008-10-02 23:17 ` Randy Brukardt
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox