comp.lang.ada
 help / color / mirror / Atom feed
From: Dmitry A. Kazakov <mailbox@dmitry-kazakov.de>
Subject: Re: Defining types in private packages for use in parent spec
Date: Wed, 27 Aug 2003 10:56:32 +0200
Date: 2003-08-27T10:56:32+02:00	[thread overview]
Message-ID: <t7rokv84cns92qdqbjkbmr8jielpq39dh3@4ax.com> (raw)
In-Reply-To: slrnbkoon6.o6.lutz@taranis.iks-jena.de

On Wed, 27 Aug 2003 07:51:02 +0000 (UTC), Lutz Donnerhacke
<lutz@iks-jena.de> wrote:

>How to solve the following problem? It's necessary to define the type Base
>in the implementation defined private subpackage, because it varies on
>various implementations.

The first design question is when implementations should be selected?
At compile time or possibly at run time? For the latter case you have
only two options: tagged types vs. discriminated types (with a variant
part or not). Otherwise there is a third opton the generics. To
summarize, the ways you could come to different implementations of a
polymorphic object:

1. Tagged types: tag --- dispatch ---> implementation
2. Discriminated types: discriminant(s) --- case ----> implementation
3. "Generic" types: parameter(s) --- instantiation ---> implementation

Private vs. public, child vs. unrelated package is the second and less
important question. Usually when you solve the first and define the
public interface of your objects, you will have little choice to
decide.

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



  reply	other threads:[~2003-08-27  8:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-27  7:51 Defining types in private packages for use in parent spec Lutz Donnerhacke
2003-08-27  8:56 ` Dmitry A. Kazakov [this message]
2003-08-27  9:03   ` Lutz Donnerhacke
2003-08-29 17:02 ` Stephen Leake
replies disabled

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