W3C home > Mailing lists > Public > www-dom@w3.org > January to March 2000

Re: Comments on DOM2 CR

From: Stephen R. Savitzky <steve@rsv.ricoh.com>
Date: 03 Mar 2000 16:08:52 -0800
To: www-dom@w3.org
Message-ID: <qcaekfmwa3.fsf@congo.crc.ricoh.com>
keshlam@us.ibm.com writes:

> In DOMs which support the Traversal feature, the DocumentTraversal
> interface will be implemented by Document objects. This is shown in the
> examples:
>      NodeIterator
> iter=((DocumentTraversal)document).creatNodeIterator(node,
> NodeFilter.SHOW_ELEMENT, myFilter);

Really?!!  That's disgusting -- it forces the use of a cast. 

OK, so it's no worse than anything <em>else</em> in the DOM, which simply
<strong>cannot be used safely</strong> without run-time type checking.  That
doesn't make it right.

I guess I'm just too much of a language purist for this business -- I've
always been of the opinion that if you're forced to resort to a cast in
order to do something, you've found a serious design flaw in the API.

A better alternative would be a getDocumentTraversal method on Document or,
better, DOMImplementation: it would of course return null if the Traversal
feature was unimplemented.

-- 
Stephen R. Savitzky  <steve@rsv.ricoh.com>  <http://rsv.ricoh.com/~steve/>
Platform for Information Applications:      <http://RiSource.org/PIA/>
Chief Software Scientist, Ricoh Silicon Valley, Inc. Calif. Research Center
 voice: 650.496.5710  front desk: 650.496.5700  fax: 650.854.8740 
  home: <steve@theStarport.org> URL: http://theStarport.org/people/steve/
Received on Friday, 3 March 2000 19:10:03 GMT

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