comp.lang.ada
 help / color / mirror / Atom feed
* overriding in private part
@ 2008-10-02 15:49 Maxim Reznik
  2008-10-02 16:42 ` Adam Beneschan
  2008-10-02 23:17 ` Randy Brukardt
  0 siblings, 2 replies; 15+ messages in thread
From: Maxim Reznik @ 2008-10-02 15:49 UTC (permalink / raw)


Hi all

Trying to find memory leak in AWS I found strange bug.

Let my explain by example: http://pastebin.mozilla-russia.org/92280

There is a package hierarchy of three packages: A1, A1.A2 and A1.A3.
And type hierarchy: A1.Base, A2.Child derived from A1.Base, A3.Child
derived from A2.Child.

A1.Base has primitive procedure P2 in private part of A1.
A2.Child override P2 with its own P2 in private part of A2.
A3.Child is expected to override P2 with its own P2 in private part of
A3, but actually it can't!
As result A3.P2 is never called in this example. (And never free
memory in AWS)

My expectation about this code, that A3.P2 override A1.P2 because
private part of A1 is visible at this place, and A2.P2 invisible here,
so have no influence here. But A2.P2 hides A1.P2 indeed.

Every type in class A1.Base'Class has P2 primitive subprogram, but any
child of A2.Child can't override it, because P2 is hidden by A2.P2. It
seems unnatural to me.

Errors of such kind are very difficult to find.

Is there any way to prevent such errors? (Besides keyword
*overriding*)

--
Maxim Reznik



^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2008-10-06 23:39 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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