comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Carter <jrcarter@acm.org>
Subject: Re: Common sense...
Date: Sat, 06 Jul 2002 01:26:36 GMT
Date: 2002-07-06T01:26:36+00:00	[thread overview]
Message-ID: <3D26473B.581C61BC@acm.org> (raw)
In-Reply-To: pYlV8.2280$7i3.138243@newsfep1-win.server.ntli.net

"chris.danx" wrote:
> 
> "Jeffrey Carter" <jrcarter@acm.org> wrote in message
> news:3D25E607.E59E11E2@acm.org...
> > Deleting nodes from an iterator is erroneous and should raise an
> > exception.
> 
> ok but how would you enforce that.  Just not support it?  That's no bother
> as the iterators aren't written yet.

The PragmAda Reusable Components' list components' iterators will raise
an exception (Invalid_Position) if the client-supplied action deletes
the current node. This is a consequence of assigning a unique ID to each
list, marking each Position and node with the ID of the associated list,
and invalidating the ID when a node is deleted.

A simpler approach might be to add a Boolean field to the list structure
that the iterator sets True before it begins traversing the list, and
sets False when the iteration is finished. Deletion would then check
this field first, and raise the exception if it is True.

-- 
Jeff Carter
"If you think you got a nasty taunting this time,
you ain't heard nothing yet!"
Monty Python and the Holy Grail



  reply	other threads:[~2002-07-06  1:26 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-05 17:19 Common sense chris.danx
2002-07-05 17:28 ` Wes Groleau
2002-07-05 17:58   ` chris.danx
2002-07-05 21:34     ` Wes Groleau
2002-07-05 18:31 ` Jeffrey Carter
2002-07-05 18:54   ` chris.danx
2002-07-06  1:26     ` Jeffrey Carter [this message]
2002-07-06 10:28       ` chris.danx
2002-07-06 20:07         ` Jeffrey Carter
2002-07-06  6:52   ` Simon Wright
2002-07-05 20:16 ` chris.danx
2002-07-06  6:51 ` Simon Wright
2002-07-12 18:01   ` chris.danx
replies disabled

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