comp.lang.ada
 help / color / mirror / Atom feed
From: "Ehud Lamm" <mslamm@mscc.huji.ac.il>
Subject: Re: When to use 'Class in a parameter list
Date: Tue, 24 Jul 2001 00:39:10 +0300
Date: 2001-07-24T00:39:10+03:00	[thread overview]
Message-ID: <9ji5j7$hlu$1@news.huji.ac.il> (raw)
In-Reply-To: 9ji1b3$4pi$1@nh.pace.co.uk

Marin David Condic <marin.condic.auntie.spam@pacemicro.com> wrote in message
news:9ji1b3$4pi$1@nh.pace.co.uk...
> So unless I'm doing something strange that is causing some corner-case to
> come up, I'm now wondering why I would need Base_Type'Class as a parameter
> type? I was under the impression that I would use 'Class if I wanted to
make
> an operation that worked on anything derived from the class without
explicit
> conversion. (Possible to override it in a child class, AFAIK...)


You mean _impossible_ right?

Basically if you want overriding to be an option you use a primitive
operation. Notice that you have to think about the possible evolution of the
system, not about how things work the first time around.

The main question is not about the conversion, but whether calling the
routine requires run-time dispatching. (essentialy, the class-wide routine
doesn't need dispatching). The Rationale has a couple of tables that nicely
show the dispatching/non-dispatching semantics of the various parameter
lists.

It may be helpful to think of class-wide routines as a language incarnation
of the "template method" design pattern. They allow you to specify a general
alogirthm that may work differently on different derived types, by invoking
dispatching routines.
(Now, I must admit, this would work better with MI, but MI is evil...)

Ehud Lamm






  reply	other threads:[~2001-07-23 21:39 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-23 20:27 When to use 'Class in a parameter list Marin David Condic
2001-07-23 21:39 ` Ehud Lamm [this message]
2001-07-24 12:49   ` Marin David Condic
2001-07-24 14:39     ` Dmitry A. Kazakov
2001-07-24 15:16     ` Ehud Lamm
2001-07-24 17:16       ` Marin David Condic
2001-07-23 22:55 ` Stephen Leake
2001-07-25 19:20   ` Deligation with Ada95 Hans-Olof Danielsson
2001-07-26  2:06     ` Lao Xiao Hai
2001-07-24  2:22 ` When to use 'Class in a parameter list Vincent Marciante
2001-07-24 12:52   ` Marin David Condic
2001-07-24 14:36     ` Ed Falis
2001-07-24 15:29       ` Ehud Lamm
2001-10-29 22:52 ` Matthew Heaney
replies disabled

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