OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] The subsetting has begun

[ Lists Home | Date Index | Thread Index ]


> Karl Waclawek scripsit:
> 
> > I agree. It would be nice, however, if SAX for instance allowed
> > an application to stop parsing (based on an event) without 
> > having to throw an exception.
> 
> What's wrong with exceptions?  This kind of thing, abandoning an action,
> is what they were made for. 

Maybe that is different for Java, but in general this is simply wrong.
Program flow should not be controlled with exceptions.
Apart from that they are expensive in most languages.

And you have to trap them in your app, since you might not actually want to
terminate the routine where the parse call returns to.

In addition, low level code should return a status and leave the decision
whether an exception should be thrown to the higher level code that
has sufficient context to make it.

> If one of your SAX handlers decides that
> there is no point in reading further, create an AllDoneException packaged
> inside a SAXException, and away we go.

Well, we (a group of programmers) ported SAX2 to Delphi.
On Delphi the idea of using exceptions for regular program flow control
is just not right. Same in C++.

And like C++, Delphi is sometimes used for speed, meaning that
one takes care about memory allocations. Exceptions are too
expensive from that point of view, which matters if the program
is meant to continue, and matters less if the current context has to
be terminated.

Karl




 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS