comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: Booch Components question
Date: Tue, 15 Nov 2011 09:23:42 +0000
Date: 2011-11-15T09:23:42+00:00	[thread overview]
Message-ID: <m21ut9buxt.fsf@pushface.org> (raw)
In-Reply-To: s5buyaqq6p05.1fu00eagpxjac$.dlg@40tude.net

"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes:
> On Mon, 14 Nov 2011 17:18:14 -0600, Randy Brukardt wrote:

>> OTOH, the name "list" seems highly confusing. "List" seems to have
>> gained a fairly standard meaning in the use of containers, and I'm
>> not surprised that most people look there first. Having something
>> that works rather differently with that name is asking for trouble.
>
> Hmm, what do you mean? The BC's list looks pretty much like list to
> me.

On the surface, yes. But the 'structural sharing' is both hairy and
difficult to understand.

   --  These abstractions have been carefully constructed to eliminate
   --  all storage leaks, except in the case of intentional
   --  abuses. When a list is manipulated, all items that become
   --  unreachable are automatically reclaimed. Furthermore, this
   --  design protects against dangling references: an item is never
   --  reclaimed if there exists a reference to it.

What about unintentional abuses, I ask! or even just mistakes.

   --  Unreachable items are those that belong to a list or a sublist
   --  whose head is not designated by any alias. For example,
   --  consider the list (A B C), with the head of the list designated
   --  by L1. L1 initially points to the head of the list, at item
   --  A. Invoking the member function Tail on L1 now causes L1 to
   --  point to item B. Because A is now considered unreachable, the
   --  storage associated with item A is reclaimed; the predecessor of
   --  B is now null. Similarly, consider the list (D E F), with the
   --  head of the list designated by both L1 and L2. Both L1 and L2
   --  are aliases that initially point to the head of the list at
   --  item D. Invoking the member function Tail on L1 now causes L1
   --  to point to item E; L2 is unaffected. Suppose we now invoke the
   --  member function clear on L2. The semantics of this operation
   --  are such that only unreachable items are reclaimed. Thus, the
   --  storage associated with item D is reclaimed, because it is no
   --  longer reachable; L2 is now null, and the predecessor of E is
   --  now null. Items E and F are not reclaimed, because they are
   --  reachable through L1.

Ugh.



  reply	other threads:[~2011-11-15  9:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-12 16:11 Booch Components question Simon Wright
2011-11-14 23:18 ` Randy Brukardt
2011-11-15  9:00   ` Dmitry A. Kazakov
2011-11-15  9:23     ` Simon Wright [this message]
2011-11-15 10:08       ` Dmitry A. Kazakov
2011-11-15 10:06   ` Simon Wright
2011-11-15 11:19     ` Simon Wright
2011-11-15 23:26       ` Jeffrey Carter
replies disabled

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