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

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

From: Peter Meyer <petermeyer99@hotmail.com>
Date: Tue, 27 Mar 2001 23:43:17 -0000
To: chainsword@altavista.com, keshlam@us.ibm.com
Cc: www-dom@w3.org
Message-ID: <F97yRLVbNDN4CxpAOAk0000f16e@hotmail.com>
Actually, I would argue that a switch on a type field is *NOT* necessarily a 
safe programming construct. There once was an article, when procedural 
programming was new, called: GoTo considered harmful. Many of the same 
arguments hold up for switch statements in object oriented programming :-)

As I understand, the result of the discussion was:
- I owe you a use case where the switch statement is really a problem.
- We identified a problem with visitors for library design: As all execute 
methods need to be defined in the Visitor baseclass, a base visitor 
implementation can not be part of the library. I am not sure if this is a 
fatal problem, but it certainly makes a big dent in the area of elegance :-)

So as I doubt I can find a use case that is ugly enough with switch 
statements to overcome the second concern listed above, I am afraid I'll 
have to live with a dispatch loop based on switch statements :-(

Thanks for all the discussion...

   PM

>From: Americo Albuquerque <chainsword@altavista.com>
>To: keshlam@us.ibm.com
>CC: www-dom@w3.org
>Subject: Re: Type-safe iteration over the DOM in DOM 2 & 3?
>Date: 27 Mar 2001 04:08:52 -0800
>
>On Mon, 26 March 2001, "Joseph Kesselman" wrote:
>
> > If you're going to do the switch, you might as well do
> > it in the scanning loop rather than in the object, for reasons 
>previously
> > discussed.
> >
>
>That's my point. Since the DOM has to work in all languages the easy way to 
>do it is in the scanning loop. Never the less, the switch is a safe way to 
>track coding errors and that is good reason for using it. We must have in 
>mind that the DOM isn't a self language but a model to use in any language 
>that suport it.
>
>
>Find the best deals on the web at AltaVista Shopping!
>http://www.shopping.altavista.com
>

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
Received on Tuesday, 27 March 2001 18:44:00 GMT

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