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-Thread: 103376,7e81a70d49e1dad0 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!elnk-atl-nf1!newsfeed.earthlink.net!stamper.news.atl.earthlink.net!newsread2.news.atl.earthlink.net.POSTED!14bb18d8!not-for-mail Sender: mheaney@MHEANEYX200 Newsgroups: comp.lang.ada Subject: Re: Adding functions to generic package References: <429891d3$1@news.broadpark.no> From: Matthew Heaney Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sat, 28 May 2005 16:27:46 GMT NNTP-Posting-Host: 24.149.57.125 X-Complaints-To: abuse@earthlink.net X-Trace: newsread2.news.atl.earthlink.net 1117297666 24.149.57.125 (Sat, 28 May 2005 09:27:46 PDT) NNTP-Posting-Date: Sat, 28 May 2005 09:27:46 PDT Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: g2news1.google.com comp.lang.ada:11195 Date: 2005-05-28T16:27:46+00:00 List-Id: Preben Randhol writes: > I'm using the charles library which has a generic list package. I > would like to add two procedures Randomise and Move so that all my > lists can use them. I cannot modify the library itself, so what > choices do I have? Is making a child package the only way to add the > procedures in a generic way? If you want to take advantage of the representation of the list container type, then you would have to create a child. Otherwise, if your algorithm can be implemented in terms of the already-existing (primitive) operations of the type, then it doesn't have to be a child. You could do something like: with Charles.Lists.Double.Unbounded; generic with package P is new Charles.Lists.Double.Unbounded (<>); use P; package Generic_List_Ops is procedure Randomize (Container : in out Container_Type); procedure Move (...); end; If these are truly generic algorithms, then you could implement them as, well, generic algorithms, and then either use those as is, or use them to implement the generic package above. What do Randomize and Move do? If you have a tentative implementation, then post it (or just mail it to me) and we can figure what is the best option for you. -Matt