Re: NodeList (Re: CSS::SAC)

At 11:20 21/03/2001 -0500, Joseph Kesselman wrote:
>>I'm gunning for (to a certain degree at first, more later) but so is
>>performance. Live NodeLists just don't work with the latter
>
>There are some fairly straightforward implementation tricks which keep the
>overhead minimal when NodeLists are not actively in use, ranging from a
>flag which isn't set until the first NodeList is created to not rebuilding
>NodeLists until they user actually accesses them. There are a number of
>open-source fully-compliant DOMs in other languages; you might want to look
>at how they've handled NodeList before you conclude that it's
>unsupportable.

Sorry if I was unclear. I never concluded that NodeLists were
unsupportable, and in fact they are supported. Only, depending on the needs
of the user one can have various flavours. Some are NodeLists as per DOM,
others are simpler (and faster). I have some web apps that create and
process 2-3 DOMs. I know they're read-only so I request lightweight
NodeLists (ie not live). In other situations I know that liveness is
required so I pull it in.

>I freely admit that I've never liked NodeLists. I initially had  exactly
>the same concerns you've voiced. But I  discovered that I could, in fact,
>write a reasonable implementation which performs well in the most common
>cases and performs correctly in the rest without an unacceptable amount of
>impact on code size or performance of the rest of the DOM. NodeList will
>always have some cases where its performance is horrendous and behavior is
>unintuitive, but DOM users know that and write around it.

I actually don't mind NodeLists per se. It just so happens that when using
a language that has powerful ways to manipulate arrays I don't want to be
limited to item and length. I don't think that adding an array interface on
top of NodeLists is a harmful addition. Especially given that i'm flagging
it as a feature of the said DOMImplementation.

>I really would recommend that Perl implementations adopt these strategies
>and attempt full compliance with the DOM spec. Especially if you might be
>interested in some day convincing the W3C to officially recognize a
>standard Perl binding for the DOM.

I don't know if that is ever going to happen, but you never know. Chances
are the core Perlish DOM deviates too much from DOM2 to gain approval
there. But perhaps core Perlish DOM + one of the add ons may work its way
there.

-- robin b.
There are things that are so serious that you can only joke about them. --
Heisenberg

Received on Wednesday, 21 March 2001 11:52:49 UTC