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 02:33:29 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!newsfeeds.belnet.be!news.belnet.be!uni-erlangen.de!news-nue1.dfn.de!news-han1.dfn.de!news.fh-hannover.de!news.cid.net!news.enyo.de!news1.enyo.de!not-for-mail From: Florian Weimer Newsgroups: comp.lang.ada Subject: Re: A generic list package (long) Date: Mon, 03 Sep 2001 11:53:05 +0200 Organization: Enyo's not your organization Message-ID: <878zfw8uta.fsf@deneb.enyo.de> References: <87ae0dp7gn.fsf@deneb.enyo.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Xref: archiver1.google.com comp.lang.ada:12649 Date: 2001-09-03T11:53:05+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, it is