From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,5dcca0c20988c23c X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-08-27 01:49:56 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!headwall.stanford.edu!fu-berlin.de!uni-berlin.de!tar-alcarin.cbb-automation.DE!not-for-mail From: Dmitry A. Kazakov Newsgroups: comp.lang.ada Subject: Re: Defining types in private packages for use in parent spec Date: Wed, 27 Aug 2003 10:56:32 +0200 Message-ID: References: NNTP-Posting-Host: tar-alcarin.cbb-automation.de (212.79.194.111) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de 1061974195 10117928 212.79.194.111 (16 [77047]) X-Newsreader: Forte Agent 1.8/32.548 Xref: archiver1.google.com comp.lang.ada:41882 Date: 2003-08-27T10:56:32+02:00 List-Id: On Wed, 27 Aug 2003 07:51:02 +0000 (UTC), Lutz Donnerhacke 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