comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: overriding in private part
Date: Sun, 5 Oct 2008 09:35:52 +0200
Date: 2008-10-05T09:35:54+02:00	[thread overview]
Message-ID: <1vlrayvqx3imy.cp250cnppen5.dlg@40tude.net> (raw)
In-Reply-To: wcc4p3sjg7b.fsf@shell01.TheWorld.com

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.

Now, if a procedure is not overriding where an overriding was meant, that
is a semantic change of an unpredictable damage, which slips undetected
through [*]. I think that actually the opposite case is safer. Let the
procedure is an occasional overriding. That does not influence any
type-specific code, because no dispatch happens there. It changes only the
semantics of class-wide code written in terms of parent classes.

There seems to be no safe default.

---------
* Unless the operation is abstract

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  reply	other threads:[~2008-10-05  7:35 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
2008-10-04 19:47           ` Robert A Duff
2008-10-05  7:35             ` Dmitry A. Kazakov [this message]
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