comp.lang.ada
 help / color / mirror / Atom feed
From: Florian Weimer <Florian.Weimer@RUS.Uni-Stuttgart.DE>
Subject: Re: A generic list package
Date: 03 Sep 2001 18:18:35 +0200
Date: 2001-09-03T18:18:35+02:00	[thread overview]
Message-ID: <tg7kvggsdg.fsf_-_@mercury.rus.uni-stuttgart.de> (raw)
In-Reply-To: ubskt2plw.fsf@gsfc.nasa.gov

Stephen Leake <stephen.a.leake.1@gsfc.nasa.gov> 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.



  parent reply	other threads:[~2001-09-03 16:18 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-02 22:13 A generic list package (long) Florian Weimer
2001-09-02 22:29 ` Stephen Leake
2001-09-03  9:53   ` Florian Weimer
2001-09-03 16:18   ` Florian Weimer [this message]
2001-09-03 17:16     ` A generic list package Jeffrey Carter
2001-09-04  9:40       ` Florian Weimer
2001-09-04 16:42     ` Stephen Leake
2001-09-18 14:58     ` Lutz Donnerhacke
2001-09-18 19:07       ` Simon Wright
2001-09-19  8:05         ` Lutz Donnerhacke
2001-09-19 19:45           ` Simon Wright
2001-09-20  8:21             ` Lutz Donnerhacke
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox