Re: Level 3 XPath doesn't feel right

Shelby Moore wrote:

>But my understanding of popular OO languages is that a base class virtual
>function only has to implemented in one place, and the behavior is
>inherited automatically.  The extension only needs to be implemented in
>(Node?) base class.  Am I missing something obvious?
>  
>
Yes.  Multiple implementations, from different sources is expected to be 
common.

>I just realized the two api models are NOT mutually exclusive.  The
>"getInterface" can merely expose the XPathEvaluator as an OO wrapper in the
>DOM node.  And per above, I think it only needs to be implemented in once
>place-- the base class.
>  
>
This would only be true if we expected a single implementation only ever 
supplied by the supplier of the DOM implementation.  If we believed this 
were true, I would not be arguing with you in the first place.

This is not even true in the current Mozilla implementation, where it 
may be loaded from a separate shared library.  It would be far more 
difficult to permit each node to be cast to an evaluator than to get the 
Document object castable.

Now, the logical extension, someone, in a shared library, wants to 
supply a different implementation that they will build XML-Foo on top 
of, that needs a set of functions applicable to foo.

Now, we have two versions of the implementation floating around. 
 sometimes users should get one, and sometimes the other.  It is quite 
obvious that the Foo implementation is for special-use, but should be 
able to use the same API.  Now, each node needs to be able to be cast in 
two different ways?  It is far easier for the Foo implementer to just 
get a FooXPathEvaluator and use it throughout his operations.

There are much more complicated scenarios than that that arise easily 
and are easily handles with a seperate evaluator that can be obtained 
from anywhere, that are extremely difficult if you require a node-level 
evaluator interface.

Ray Whitmer

Received on Monday, 16 December 2002 14:05:50 UTC