On Aug 3, 10:35 am, Terry Brown <[email protected]> wrote:

> IIRC, clones introduced much of the trickiness of this list delete.

The essence of the situation regarding p.deletePositionsInList is that
the call to p.moveToThreadNext in the loop must work properly even
after a previous node has been deleted.  Happily, deleting or moving
nodes properly changes the data structures used by p.moveToThreadNext--
they *must* do so for moves or deletes to work at all.  Furthermore,
deleting or moving a node never changes the *ancestors* of the next
node, *provided* that the callback doesn't move a node into the range
of the tree.

To put it another way, the loop in p.deletePositionsInList has been
carefully designed so that it will continue to work in the presence of
deleted nodes and moves outside the range.  The loop (that is,
p.moveToThreadNext)  visits descendants after visiting ancestors,
which minimizes the effects of changes.

The essential simplicity of deletePositionsInList does not absolutely
guarantee its correctness, but it is gratifying that it *is* simple
after all yesterday's work.

EKR

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en.

Reply via email to