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,2510538eb4348710 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-09-03 09:19:08 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!feed.textport.net!news.uni-stuttgart.de!cert.uni-stuttgart.de!not-for-mail From: Florian Weimer Newsgroups: comp.lang.ada Subject: Re: A generic list package Supersedes: <878zfw8uta.fsf@deneb.enyo.de> Date: 03 Sep 2001 18:18:35 +0200 Organization: RUS-CERT, University of Stuttgart, Germany Sender: rusfw@mercury.rus.uni-stuttgart.de Message-ID: References: <87ae0dp7gn.fsf@deneb.enyo.de> NNTP-Posting-Host: mercury.rus.uni-stuttgart.de Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: hornet.rus.uni-stuttgart.de 999533508 12942 129.69.1.226 (3 Sep 2001 16:11:48 GMT) X-Complaints-To: abuse@cert.uni-stuttgart.de NNTP-Posting-Date: Mon, 3 Sep 2001 16:11:48 +0000 (UTC) User-Agent: Gnus/5.090001 (Oort Gnus v0.01) Emacs/20.7 Xref: archiver1.google.com comp.lang.ada:12658 Date: 2001-09-03T18:18:35+02:00 List-Id: Stephen Leake writes: >> I'm currently working on a general-purpose low-level list package. >> The existing approaches were either too heavy-weight, too limited, or >> covered by an unacceptable license. >> >> What do you think about the approach documented below? > > I've written a list package with similar goals; see > http://users.erols.com/leakstan/Stephe/Ada/sal.html. Thanks. Your collection looks quite nice. > I find it curious that you expect the client to provide the "next" > field/operation, rather than declaring a Node_Type containing the > user's type and a Next field. Can you elaborate on this? Using this approach, you can save one indirection in the case of indefinite types. (The redirection seems necessary as well if you need a non-constant view of the actual data.) In such cases, your approach seems to result in the following: +-------------- ... +------------------+ | | o========#=======>>| actual data | | | | fields specific | +-------------- ... | to the container | +------------------+ The getter/setter aproach permits the following: +------------------+ | fields specific | | to the container | | | | actual data | . . : : And it is still possible to obtain a non-constant view of the actual data. > Your approach leaves everything up to the user; mine ensures that > garbage is collected appropriately, when necessary; the user only > needs to provide the appropriate 'free' operation. I think our approaches are not much different in this regard; if an element is removed from a list, it is also freed by my implementation.