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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,9240e56bacaf630 X-Google-Attributes: gid103376,public From: lutz@iks-jena.de (Lutz Donnerhacke) Subject: Re: Generic abstract procedures Date: 1999/10/14 Message-ID: #1/1 X-Deja-AN: 536803200 Distribution: world Content-Transfer-Encoding: 8bit References: <38062215_1@news1.prserv.net> Content-Type: text/plain; charset=ISO-8859-1 Organization: IKS GmbH Jena Mime-Version: 1.0 User-Agent: slrn/0.9.5.7 (UNIX) Newsgroups: comp.lang.ada Date: 1999-10-14T00:00:00+00:00 List-Id: * Matthew Heaney wrote: >(Lutz Donnerhacke) wrote: >> Does anybody knows a solution other than derivating the actual collection >> from an abstract tagged type? Obviously I failed with a dumb generic attempt. > >What exactly are you trying to do? It is certainly not obvious from >your post. I'm going to implement a Iterator pattern. A class like approach requires the following code: type My_Item_Type is new Item_Type with record item: Real_Item_Type; end record; type My_Collection_Type is new Collection_Type with record collection: Real_Collection_Type; end record; type My_Iterator(c: access My_Collection_Type) is new Iterator_Type(Collection_Type(c.all)'Access) with record state: ...; end record; followed by some overloaded functions to catch all the abstract functions of the type _Type is abstract tagged limited null record; The generic approach is able to provide a much simpler interface. I have to test how a generic package can be used to generate the Types above. My question is: Does anybody already solved such a problem in an elegant way?