[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: The subsetting has begun


delphi exit
On Saturday 22 February 2003 05:41, Karl Waclawek wrote:
> > Karl Waclawek scripsit:
> > > Maybe that is different for Java, but in general this is simply wrong.
> >
> > If you mean "in C++", say so, not "in general".
>
> No, I do mean: to say that using exceptions for common program flow
> control is what they are meant for, is not true in general.

Well there's no fixed dividing line between exception conditions and common 
program flow. You could say that exceptions are only for truly exceptional 
conditions such as stack overflow and hardware failure, and everything else 
should be handled by error returns... but I think few would necessarily 
agree. On the other hand you could say that, in a while loop, the normal flow 
is to repeat and it's exception to escape; if the average while loop does a 
hundred iterations then it ony stops iterating 1% of the time, which is 
pretty exceptional. Then one could write loops like this:

loop {

    ... 

    if (command = "STOP") break;

    ...
}

Many languages have just that construct. "break" is a nonlocal exit, just 
like throw / catch.

Then you have continuation-passing languages where procedure return points 
are first class objects; you explicitly pass the return address into a 
procedure, and there's nothing stopping you from passing in several, one for 
success and one for each different kind of failure, that return to different 
points in the stack.

*shrug* I think it's difficult to argue at what point a flow of control 
becomes 'exceptional'. I'm in favour of not having religious wars about it 
and just using whatever construct is most appropriate at each point in my 
code :-)

> This is no intuition. I can whip up a quick demo in Delphi
> (I already did - took 5 minutes) which shows that passing a Boolean result
> up from a 5 levels deep nested procedure call executed in a loop is at
> least 100 times as fast as throwing and catching an exception for the same
> purpose. I can post or e-mail it if you really want to see it.

Is that under Windows? ISTR that Windows has to handle some part of exception 
handling itself for some obscure reason and makes it awful slow?

Exeptions don't *need* to be slow. There are fast implementations.

>
> Karl
>

ABS

-- 
Oh, pilot of the storm who leaves no trace, Like thoughts inside a dream
Heed the path that led me to that place, Yellow desert screen

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.