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,88093378be1184d4 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-11-07 16:42:51 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsmi-us.news.garr.it!newsmi-eu.news.garr.it!NewsITBone-GARR!fu-berlin.de!uni-berlin.de!ppp-1-106.cvx5.telinco.NET!not-for-mail From: "Nick Roberts" Newsgroups: comp.lang.ada Subject: Re: List Container Straw Man Date: Wed, 7 Nov 2001 23:58:31 -0000 Message-ID: <9scke8$12jb14$3@ID-25716.news.dfncis.de> References: <9s941p$11mrei$4@ID-25716.news.dfncis.de> <9s99tt$pdb$1@nh.pace.co.uk> <9s9s8p$11vt7l$1@ID-25716.news.dfncis.de> <9sc5l8$9b7$1@nh.pace.co.uk> NNTP-Posting-Host: ppp-1-106.cvx5.telinco.net (212.1.152.106) X-Trace: fu-berlin.de 1005180169 36285476 212.1.152.106 (16 [25716]) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MIMEOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Xref: archiver1.google.com comp.lang.ada:16029 Date: 2001-11-07T23:58:31+00:00 List-Id: I probably haven't explained it well, but I think you may be getting hold of the wrong end of the stick a little. In general, according my suggested design, you would need two instantiations to start making use of a utility container. The first would instantiate the package (called Iteration let us say) of abstract types: package Widget_Iteration is new Iteration(Aerial_Widget); The second would instantiate the package declaring the utility container, using the first package - a 'signature' package - as its generic parameter: package Widget_Storage is new Linear_Linked_List_Storage(Widget_Iteration); You might then want to use a 'use', or more likely a subtype declaration to give the widget container type a convenient name: subtype Widget_Store is Widget_Storage.Store_Type; and then you can start using it: Nuts, Bolts: Widget_Store; -- initialised empty To recap, the great advantage of this design is that Widget_Store is now a general-purpose iterator type (derived from Widget_Iteration.Reproducable_Sequence probably), and so any unit that takes a widget iterator type can have Widget_Stores passed into it with no further ado. A generic procedure: generic package Specific_Iteration is new Iteration(<>); procedure Print_a_List (List: in out Specific_Iteration.Terminating_Sequence'Class); procedure Print_a_List (List: in out Specific_Iteration.Terminating_Sequence'Class) is Item: Specific_Iteration.Element_Type; begin while not End_of_Data(List) loop -- dispatching Read(List,Item); -- dispatching Put_Line(Item); end loop; end; can be used to print out the items in any container of any type (that conforms to my design): procedure Print_Widgets is new Print_a_List(Widget_Iteration); ... Print_Widgets(Nuts); Print_Widgets(Bolts); Phew! I hope this clarifies things. It's really not too difficult in actual usage, is it? In big software, it would save a huge amount of effort, and Ada is an industrial language. -- Best wishes, Nick Roberts