W3C home > Mailing lists > Public > www-dom@w3.org > October to December 1998

RE: Walking the DOM (was: XML APIs)

From: Claude Zervas <claude@utlco.com>
Date: Fri, 13 Nov 1998 15:15:41 -0800
Message-Id: <199811132325.SAA16873@www10.w3.org>
To: www-dom@w3.org
At 05:21 PM 11/13/98 +0000, Miles Sabin wrote:
>John Cowan wrote,
>> Miles Sabin wrote:
>> > Even with a remove() operation on the iterator class, this
>> > will still cause serious problems, because i will be
>> > invalidated every time a node is removed via j.
>> 
>> Agreed.  But other solutions are hardly better, since they
>> involve using remove operations with at best O(log n) behavior.
>> 
>> 1) You can't win;
>> 
>> 2) You can't even break even.
>
>Yes you can ...
>
>We just have ultra simple iterators, and *document* the
>conditions under which they remain valid, and rely on
>programmers being smart enough to know when those
>conditions hold and when they don't, or being able to
>ensure they hold (with manual updates or synchronization,
>or whatever).
>

I completely agree with Miles on this.  As long as any gotchas are
well documented, it shouldn't be a problem.
People can always do index-based traversals using live NodeLists
if iterators seem too scary.

Regards,
-Claude Zervas
Received on Friday, 13 November 1998 18:25:05 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:46 GMT