comp.lang.ada
 help / color / mirror / Atom feed
From: dmitry@elros.cbb-automation.de (Dmitry A. Kazakov)
Subject: Re: When to use 'Class in a parameter list
Date: Tue, 24 Jul 2001 14:39:34 GMT
Date: 2001-07-24T14:39:34+00:00	[thread overview]
Message-ID: <3b5d84c8.2078511@news.cis.dfn.de> (raw)
In-Reply-To: 9jjqt0$o1s$1@nh.pace.co.uk

On Tue, 24 Jul 2001 08:49:36 -0400, "Marin David Condic"
<marin.condic.auntie.spam@pacemicro.com> wrote:

>O.K. So if I make it a 'Class, it does not require runtime dispatching? The
>compiler knows from the type that it can simply degenerate to the specific
>operation, rather than jump to a dispatch table?

No there is no specific operation. A class-wide operation works for
all derived types.

>Now you've got me thinking it should dispatch. Does it or does it not?

Never. A class-wide actual is passed as-is.

>I sort of conceptualized the 'Class operations (based on examples from a
>couple of books - which I badly need to re-read apparently! :-) as "This
>procedure should work on anything derived from this class because it only
>operates on the base-level components and generally should not be something
>that is overriden". Whereas, the operations on some base type without the
>'Class operation seemed to be saying to me "O.K. This operation works on the
>base type, but you will probably be overriding it to provide additional
>capabilities when you derive a child type." Perhaps my conception of this is
>inaccurate...
>
>Maybe you can help me get my brain straightened out about this. I vaguely
>remember understanding this a couple of years ago when I was last fooling
>with it, but not having used it recently or enough, it is confusing me
>again.

I consider class-wide operations as a substitution for generic
routines parametrized by a type. The possible values of the generic
parameter are restricted to the class (the set of derived types). The
goal is same as for generics: to write code that works for some set of
types. Advantages are: no instantiation required, a class-wide
operation can be put into a library etc.

Regards,
Dmitry Kazakov



  reply	other threads:[~2001-07-24 14: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
2001-07-24 12:49   ` Marin David Condic
2001-07-24 14:39     ` Dmitry A. Kazakov [this message]
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