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

Re: latest DOM spec 19980720

From: Michael Allen <Michael.R.Allen@Eng.Sun.COM>
Date: Tue, 21 Jul 1998 17:58:21 -0700 (PDT)
Message-Id: <199807220058.RAA29878@doppio.eng.sun.com>
To: www-dom@w3.org


> > 	To avoid type checking what kind of NodeVisitor a Node has received,
> > you might make NodeVisitor an abstract base class with an Enumerated type
> > field which contains an int (or bitfield, maybe) which specifies its type.
> > That way, subclasses which the base NodeVisitor doesn't cover could check
> > the type of visitors without doing an instanceof test.
> 
> I think it would be better to extend NodeVisitor at the same time as you
> specialize Node (which, by the way, I notice that the HTML application
> doesn't do -- that's a problem):
> 
> interface HTMLNode: Node {
>   readonly attribute HTMLNode parentHTMLNode;
>   ...
> 
>   void visit(in HTMLVisitor v)
> }

	Ahhhh, yes!  Very nice, by parameterizing the same method name, you let 
the runtime type checking system take care of calling the right one for you!  
Brilliant!  And HTMLNode can do something vaguely appropriate when it gets a 
plain old NodeVisitor as well.
	
> 	
> > 	Throwing my hat in the ring,
> 
> Nice hat.

	Sometimes the ol' thinking cap pulls through.
	
							Michael Allen
Received on Tuesday, 21 July 1998 20:58:02 GMT

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