Liveness (NodeList, Traversal)

"Stephen R. Savitzky" wrote:
> 
> Now that TreeWalker is back in the spec, I would expect
> getElementsByTagName to rapidly fall into disuse.

I'll disagree.  From an application evolution perspective, it's just
impractical -- people avoid changing working code unless they need to.
It may already be disused (as in my code :-), though.

There have been many discussions in the past about "liveness", and many
folk have argued that it can't ever be "simple and efficient".  It's also
got some nasty garbage collection interactions, which severely limit the
implementation choices ... there's really only one idiom that's easily
made efficient (indexing an unchanging tree, so you can cache a "current"
node and cound from there rather than restarting from the beginning).  The
issue is not unique to the "live" NodeLists of getElementsByTagName; it
also shows up with the L2 Traversal APIs.

The Traversal feature at least gets rid of the indexed access mode,
so there's an easily identified class of mutations that cannot affect
a TreeWalker or Iterator.  But the cost to detect those mutations
seems higher -- those GC interations are now inescapable, nodes need
to know about "live" iterators and there's no way to make iterators
become "dead" (removing such knowledge to make the iterator GC-able).

I'd dearly love an explanation why anyone thinks "liveness" is important.
My initial suspicion is that it's an issue that resonates more with folk
doing GUIs and browsers than with anyone else.

- Dave

Received on Thursday, 7 October 1999 15:00:32 UTC