comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: How to test object hierarchy
Date: Mon, 22 Dec 2003 11:09:12 +0100
Date: 2003-12-22T11:09:12+01:00	[thread overview]
Message-ID: <bs6fgc$9hpvd$2@ID-77047.news.uni-berlin.de> (raw)
In-Reply-To: X62dnTGVeOQ323ui4p2dnA@comcast.com

Robert I. Eachus wrote:

> Dmytry Lavrov wrote:
> 
>>>I think that IF Ada should have multiple dispatch on different types...
> 
> In Ada, if and where you need it, you can get multiple dispatching.
> There are of course many different patterns that correspond to multiple
> dispatching, and if you want the most general pattern:
> 
> function "+" (L, R: Object) return Object;
> 
> Where unlike normal Ada, L, R and the return value can be different
> specific types.  This can be done, but you actually have to do some
> extra work "under the covers."
> 
> Normally you would declare the visible "+" as:
> 
> function "+" (L: Object; R: Object'Class) return Object'Class;
> 
> Then in the private part you would have a function which is called by
> the visible "+" but dispatches on the second parameter, and result type:
> 
> function Add (L: Object'Class; R: Object) return Object;
> 
> Or L may be of some general representation type.  But from experience,
> doing all this is a lot of work, and you don't want to even think about
> extending Object beyond the initial set of specific types.  You don't
> have to rethink the entire structure when you do that, but it may be the
> only way to produce something that is understandable to humans.

This is an argument in favor of implementing MD in Ada, I suppose (:-))

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



  reply	other threads:[~2003-12-22 10:09 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
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 [this message]
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