Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] Code compactness vs instanceof

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Laurent Bihanic <laurent.bihanic AT atosorigin.com>
  • To: XOM-interest <XOM-interest AT lists.ibiblio.org>
  • Subject: Re: [XOM-interest] Code compactness vs instanceof
  • Date: Fri, 20 Sep 2002 11:35:13 +0200

Remko Popma wrote:
>>Do you see something different? What do you think the code should
>>look like? (Actually what I think the code should look like is
>>polymorphic method dispatching, where I can pass a Node to a
>>process() method and have the runtime choose the overloaded method to
>>dispatch based on the node's subtype, but that's not a feature Java
>>gives us so we have to deal. :-( )
>
> If this is really an issue, you could use the "double dispatch" pattern, eg:

Yes, double dispatch is a good solution. Which brings us back to the tree
walking / visitor issue!

Laurent





Archive powered by MHonArc 2.6.24.

Top of Page