Re: Comments on the use of exceptions...

At 03:45 PM 8/20/98 -0400, keshlam@us.ibm.com wrote:
>Re exception on NamedNodeMap out of range: I think that's the same issue as
>"why do the stream operations return the character -1 at end of file rather
>than throwing an exception?" It boils down to a combination of aesthetics
>and convenience of coding and traditional programming practice... I can
>argue this one either way, but it's not obviously wrong as it stands.

Right.  Another twist is that we need to support implementations that
understand indexes natively and efficiently, and those that have indexed
interfaces grafted on to a tree or linked list internal data structure.
When looping over all child nodes, or all nodes returned by
getElementsByTag name, we DO NOT want to force the user to call the size()
[or whatever we ended up calling it; sorry I'm in a hurry ...] method to
figure out how far to loop, because that might force the implementation to
travel all the relevant Nodes and count them. Instead, we let DOM
programmers loop until an indexed lookup returns an error, which can be
efficient with either implementation.

So, we DO NOT consider index out of bounds conditions as a programming
error, but something that we expect under normal circumstances.

Mike Champion

Received on Thursday, 20 August 1998 15:56:24 UTC