From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: How to test object hierarchy
Date: Fri, 19 Dec 2003 18:07:05 +0100
Date: 2003-12-19T18:07:05+01:00 [thread overview]
Message-ID: <brvas0$7ugsq$1@ID-77047.news.uni-berlin.de> (raw)
In-Reply-To: 1071844528.57052@master.nyc.kbcfp.com
Hyman Rosen wrote:
> Dmitry A. Kazakov wrote:
>> You have to override Test_Hierarchy for each new type
>
> Which brings a question to my non Ada-knowing mind.
> I know that for a subprogram to be dispatching, it
> must be defined in the same package (or immediately
> after?) as the tagged type upon which it dispatches.
Before the freezing point, which is informally at the first "non-trivial"
use of the type before the package specification end.
> Can an instantiation of a generic be dispatching in
> this way? Could I do (pardon the syntax errors)
> procedure Test_Hierarchy is new
> Generic_Test_Hierarchy(Type1=>Derived_Object);
> rather than copy the code each time?
Aside, it is actually what inheritance is for! The problem is that there is
no [proper] multiple dispatch in Ada.
Well, an implementation of a dispatching subprogram through instantiation of
a generic one is not allowed in either Ada or C++. One step up. A generic
primitive operation is also not allowed in both. Another step up. Generic
types do exist in C++, but not in Ada, where same effect is achieved using
generic packages.
A strategic question is, whether one realy should exploit all possible
combinations of inheritance [and all other language things] and generics.
You know my opinion, down with generics! And there will be no question
anymore! (:-))
--
Regards,
Dmitry A. Kazakov
www.dmitry-kazakov.de
next prev parent reply other threads:[~2003-12-19 17:07 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-12-18 18:24 How to test object hierarchy Pierre Favier
2003-12-19 0:15 ` Stephen Leake
2003-12-19 7:45 ` Pierre Favier
2003-12-19 10:53 ` Dmitry A. Kazakov
2003-12-19 14:35 ` Hyman Rosen
2003-12-19 17:07 ` Dmitry A. Kazakov [this message]
2003-12-19 23:26 ` Robert A Duff
2003-12-20 18:20 ` Robert I. Eachus
2003-12-19 17:25 ` Georg Bauhaus
2003-12-20 11:13 ` Dmitry A. Kazakov
2003-12-21 4:34 ` Georg Bauhaus
2003-12-21 13:43 ` Dmitry A. Kazakov
2003-12-21 19:58 ` Dmytry Lavrov
2003-12-22 1:19 ` Robert I. Eachus
2003-12-22 10:09 ` Dmitry A. Kazakov
2003-12-22 17:33 ` Robert I. Eachus
2003-12-23 10:49 ` Dmitry A. Kazakov
2003-12-22 10:05 ` Dmitry A. Kazakov
2003-12-19 17:24 ` Nick Roberts
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox