Re: Type-safe iteration over the DOM in DOM 2 & 3?

A very good point... and on top of that, as just discovered in my 
side-discussion with James, I was in error assuming that the base visitor 
interface would just need to declare the execute(Node) method, while other 
ones could be added in subclasses or implementors. Unfortunately, the base 
class needs to have all methods listed, so that my idea of easy 
extensibility does not quite work.


>From: "Joseph Kesselman" <keshlam@us.ibm.com>
>To: www-dom@w3.org
>Subject: Re: Type-safe iteration over the DOM in DOM 2 & 3?
>Date: Thu, 22 Mar 2001 13:34:04 -0500
>
>
> >The reason why myvisitor.execute(mynode) does not work is that at the
>point
> >where this code is called the object you are dealing with is only known 
>to
> >be of class node.
>
>In other words, the reason you're using the accept-and-callback is because
>you've overloaded execute() to select different callbacks based on the
>datatype of the argument.
>
>Unfortunately method overloading isn't supported in all languages, so the
>DOM API design can't rely on it. If the architecture wants a different
>callback method for each node type, they must be named differently. I wish
>it were otherwise, but that's part of the cost we accepted in trying to
>design an architecture that could support bindings in a wide variety of
>languages.
>
>______________________________________
>Joe Kesselman  / IBM Research
>

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Received on Thursday, 22 March 2001 15:14:46 UTC