[Quoting Hildo Biersma, on August 4 2000, 08:40, in "Re: try/catch (Was: "] > Yes, but... this is largely casued by the fact that Java requires you to > declare any uncaught parameters on your method specification, and this > tends to have a nasty oil-slick effect. > > If you do it the C++ way, you can say: > > try { > first_sub_that_throws_exceptions(); > second_sub_that_throws_exceptions(); > } catch { > it went wrong > } How does 'it went wrong' know _which_ of the subs went wrong? For example: try { open(file1); open(file2); open(file3); } catch { error("could not open one of the file(s)"); } which is not very helpful to the user. And try { open(file1) } catch { error("could not open file1"); } try { open(file2) } catch { error("could not open file2"); } try { open(file3) } catch { error("could not open file3"); } is not very helpful to the programmer. Bottom line: I really appreciate the try/catch mechanism. But let's learn from C++ and Java how _not_ do do it. -- Johan
- Re: RFC: Modify open() and opendir() to return handles Tom Christiansen
- Re: RFC: Modify open() and opendir() to return hand... Graham Barr
- Re: RFC: Modify open() and opendir() to return ... Tom Christiansen
- Re: RFC: Modify open() and opendir() to return ... Graham Barr
- Re: RFC: Modify open() and opendir() to return ... Tim Jenness
- Re: RFC: Modify open() and opendir() to return ... Peter Scott
- Re: RFC: Modify open() and opendir() to return ... Johan Vromans
- Re: RFC: Modify open() and opendir() to return ... Steve Simmons
- try/catch (Was: Re: RFC: Modify open() and open... Johan Vromans
- Re: try/catch (Was: Re: RFC: Modify open() and ... Hildo Biersma
- Re: try/catch (Was: Re: RFC: Modify open() and ... Johan Vromans
- Re: try/catch (Was: Re: RFC: Modify open() and ... Graham Barr
- Re: try/catch (Was: Re: RFC: Modify open() and ... Tom Christiansen
- Re: try/catch (Was: Re: RFC: Modify open() and ... Graham Barr
- Re: try/catch (Was: Re: RFC: Modify open() and ... Nathan Wiger
- Re: try/catch (Was: Re: RFC: Modify open() and ... Tom Christiansen
- Re: try/catch (Was: Re: RFC: Modify open() and ... Nathan Wiger
- Re: try/catch (Was: Re: RFC: Modify open() and ... Tom Christiansen
- Re: try/catch (Was: Re: RFC: Modify open() and ... Nathan Torkington
- Re: try/catch (Was: Re: RFC: Modify open() and ... Tom Christiansen
- Re: try/catch (Was: Re: RFC: Modify open() and ... Peter Scott