SJS wrote:
Hm. I still don't see, but then, I've never *used* R-trees.
Think about query. If you have an arbitrary chance of going left or right in a tree, you either have to rely on the recursive stack to unwind you when you get a negative result, or you have to build up a trail of "breadcrumbs" to get back up. While I *can* manage the breadcrumbs, why should I *have* to--that's why I have a programming language to begin with--to manage this kind of housekeeping.
This normally comes up when you can't store a backward pointer in the structure itself(too many leaf objects--eg. VLSI polygons numbering in the 100's of millions).
Casting from Object can be bypassed by using double-dispatch, but that involves "callbacks", which you seem to object to.
It's not that I object to callbacks. It's that I object to having to construct the entire state machine *by hand* in order to parse the document content. This is *painful* when you have a tag like, say, <date> which can exist at different levels in the hierarchy quite happily.
The people who work with what I have seen referred to as "PullDOM" mode seem to do best. They work event-based at the upper couple of levels, and then tell the system "Pull the tree from this point until the nesting ends". This lets you discard the large hunks of the XML you don't care about and only build the event state machine for the bit you do.
(And anyone using object inheritance for a tree is just ASKING for trouble; that's why we have interfaces.)
Agreed, but if you don't a priori know which node you are sitting on, you have to be able to handle *all* the interface calls at every node. Therefore, you have all of the attribute interface calls even if your node has no attributes. You have all of the child interface calls even if your node has no children, etc.
It's not impossible to do (as demonstrated by the fact that so many XML parsers exist), but it gets clunky.
The people who work with what I have seen referred to as "PullDOM" mode seem to do best. They work in an event-based
I tend to favor XPath.
There is a reason why folks wanted the ability to query and let somebody else handle the parsing.
I try to avoid recursion (when working with XML) entirely, because I mostly don't care about the structure anymore. This probably explains why I find XML so painful. . . :)
Yeah, techies never seem to learn the lesson that recursion and nesting are okay as long as they are *shallow*.
-a -- [email protected] http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg
