W3C home > Mailing lists > Public > www-dom@w3.org > July to September 1998

Re: Comments on the use of exceptions...

From: Mike Champion <mcc@arbortext.com>
Date: Thu, 20 Aug 1998 15:56:04 -0400
Message-Id: <3.0.5.32.19980820155604.00b12540@pophost.arbortext.com>
To: keshlam@us.ibm.com, www-dom@w3.org
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:45 GMT