comp.lang.ada
 help / color / mirror / Atom feed
From: Maxim Reznik <reznikmm@gmail.com>
Subject: overriding in private part
Date: Thu, 2 Oct 2008 08:49:10 -0700 (PDT)
Date: 2008-10-02T08:49:10-07:00	[thread overview]
Message-ID: <45b4a4cc-13f5-4175-9061-9c962e32d762@64g2000hsm.googlegroups.com> (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



             reply	other threads:[~2008-10-02 15:49 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-02 15:49 Maxim Reznik [this message]
2008-10-02 16:42 ` overriding in private part 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
replies disabled

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