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 ]

I don't know why we argue about this being a good practice in Java.
Although it is an integral part of serious error handling, even in
J2SDK1.4, exception paths are about 3 orders of magnitude slower than
return values (I just retested this to make sure its an accurate
statement for recent VMs). So as a regular course of processing
exceptions are *not* the right solution for most applications.

> > 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
> 
> -----------------------------------------------------------------
> The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
> initiative of OASIS <http://www.oasis-open.org>
> 
> The list archives are at http://lists.xml.org/archives/xml-dev/
> 
> To subscribe or unsubscribe from this list use the subscription
> manager: <http://lists.xml.org/ob/adm.pl>






 

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

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