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 18:29:08 +0300
Date: 2001-07-24T18:29:08+03:00	[thread overview]
Message-ID: <9jk49h$ktk$1@news.huji.ac.il> (raw)
In-Reply-To: 3B5D8819.E9D8AD4E@mediaone.net


Ed Falis <efalis@mediaone.net> wrote in message
news:3B5D8819.E9D8AD4E@mediaone.net...
> There are two situations I find useful for using classwide parameters.
>
> The first is when I want to force that the implementation of a routine
> will not be overridden by derived type.

Indedd. I failed to mention this reason, since it seemed like this is what
Marin focused on, where as I find the second reason of greater design
importance. But it is useful to keep this in mind (as well as trick for
making routines non-primitive, like declaring them in a child unit).

>
> The second is for implementing a "template pattern", where some overall
> processing is applied regardless of the specific type of the parameter,
> and dispatching is used within the routine to handle variation among
> specific types.  For instance, when traversing a tree, certain steps are
> applied to all nodes, whether internal or leaf, while others depend on
> the status of the node (composite pattern).  So here the traversal
> operation would use a classwide parameter, while the action applied
> within it, would dispatch.
>

Another example is having a "traversable" interface with
get_first/get_next/end_of_sequence operations, and creating various general
algorithms (like filters).

Ehud Lamm





  reply	other threads:[~2001-07-24 15:29 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
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 [this message]
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