comp.lang.ada
 help / color / mirror / Atom feed
From: Dmitry A. Kazakov <mailbox@dmitry-kazakov.de>
Subject: Re: Q: Endless loop by dispatching
Date: Tue, 15 Jul 2003 10:47:14 +0200
Date: 2003-07-15T10:47:14+02:00	[thread overview]
Message-ID: <h5c7hvgol0sscrnaj98qp071903m9hoh5c@4ax.com> (raw)
In-Reply-To: vh5u1m69ig8r58@corp.supernews.com

On Mon, 14 Jul 2003 13:38:14 -0500, "Randy Brukardt"
<randy@rrsoftware.com> wrote:

>"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message
>news:erm4hvsg533tp2hkhsj86tftu0s8i0ot9j@4ax.com...
>> 2. To have an ability to refer the immediate parent [and visible
>> ancestor] types. However, this feature should be carefully designed to
>> keep a way free to multiple inheritance. Something like this:
>>
>> if X in S'Class then X'Super (S) is the most specific ancestor type in
>> S'Class. For single inheritance case, it is abbreviated to S'Super.
>>
>> For tags 'Pred and 'Succ attributes should be defined to get tags
>> along a derivation path:
>>
>> T'Pred (S) is the tag of a base type in S'Class, T'Succ (S) is the tag
>> of a derived type in 'not S'Class or S' (all ancestors of S including
>> S). Constraint_Error if the result does not exist or is ambiguous.
>
>We discussed something like this when we were discussing controlling
>dispatching. However, there is a significant problem in that a type can have
>two (related) parents:
>
>     package P is
>        type NT is new T1 with private;
>     private
>        type NT is new T2 with private;
>     end P;
>
>     with P;
>     procedure Q is
>     begin
>            NT'Parent -- ???
>
>Does NT'Parent refer to T1 or T2? If it returns T2, we're breaking
>privateness (with all of the methodlogical and implementation problems that
>entails). If it returns T1, we're not really getting the right answer, and
>moreover, the result changes with visibility (yuck!).
>
>Thus, we haven't really moved forward on this.

Ah, you mean this:

package A is
   type X is tagged null record;
   type XX is new X with null record;
end A;

with A;  use A;
package B is
   type Y is new X with private;
private
   type Y is new XX with null record;
end B;

It is an interesting case. Though I see little harm if Y'Parent would
give different answers depending on scope. It would be indeed nasty if
somebody would try to call Y'Parent.Finalize, but why should one wish
a thing like that? Anyway if he would using explicit type
specification, then he could get nothing better than Y'Parent would
offer. But I agree that it is unattractive.

Probably it is worth to think how to eliminate any need in Y'Parent?
For example one could provide some sort of overriding by extension.
I.e. the bodies which would implicitly call the overriden body, as it
is manually made in Initialize/Finalize.

---
Regards,
Dmitry Kazakov
www.dmitry-kazakov.de



  reply	other threads:[~2003-07-15  8:47 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-11  8:22 Q: Endless loop by dispatching Michael Erdmann
2003-07-11  9:46 ` Jean-Pierre Rosen
2003-07-11 15:19   ` Michael Erdmann
2003-07-11 10:01 ` Q: " Dmitry A. Kazakov
2003-07-11 15:07   ` Michael Erdmann
2003-07-12  1:41     ` Jeffrey Carter
2003-07-14  8:48     ` Dmitry A. Kazakov
2003-07-14 18:38       ` Randy Brukardt
2003-07-15  8:47         ` Dmitry A. Kazakov [this message]
2003-07-15 17:23           ` Randy Brukardt
2003-07-16  8:08             ` Dmitry A. Kazakov
2003-07-16 17:44               ` Robert I. Eachus
2003-07-17  1:57               ` Robert A Duff
2003-07-18  9:10                 ` Dale Stanbrough
2003-07-18 20:26                   ` Robert I. Eachus
2003-07-18 21:35                     ` tmoran
2003-07-19  0:25                       ` Robert I. Eachus
2003-07-19  2:30                         ` tmoran
2003-07-19  5:48                           ` Robert I. Eachus
2003-07-21  8:38                             ` Dmitry A. Kazakov
2003-07-21 10:08                               ` Robert I. Eachus
2003-07-21 13:21                                 ` Dmitry A. Kazakov
2003-07-21 18:51                                   ` Robert I. Eachus
2003-07-22  7:41                                     ` Dmitry A. Kazakov
2003-07-22 10:36                                       ` Lutz Donnerhacke
2003-07-22 12:11                                         ` Dmitry A. Kazakov
2003-07-22 12:18                                           ` Lutz Donnerhacke
2003-07-22 14:46                                             ` Dmitry A. Kazakov
2003-07-22 15:11                                               ` Lutz Donnerhacke
2003-07-23  8:12                                                 ` Dmitry A. Kazakov
2003-07-19 14:44                     ` Chad R. Meiners
2003-07-20 12:36                       ` Robert I. Eachus
2003-07-11 16:27 ` T. Kurt Bond
2003-07-12  8:37   ` Michael Erdmann
2003-07-15  7:11     ` Kenneth Almquist
replies disabled

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