On Tue, 15 Aug 2000, Peter Scott wrote (with >):

[what is the purpose of having an explicit 'try']

> Well, for one, it makes it easier to see that a block is subject to 
> exception handling if all you have to do is look at the beginning for 'try' 
> rather than scan through it for a 'catch'. 

        A good point.

> And there's the issue Jonathan Scott Duff raised, which is that the
> question of which catch blocks will be applied in what order is
> non-obvious to the user, even though there may be a well-defined
> interpretation.

        I disagree with this point.  Catch blocks should simply be
applied in the order written.  If you have a "floating" catch block--i.e.,
one that isn't connected to anything that throws an exception--then you
have some code that will never run.  No big deal, and possibly useful as
yet another option for Multi-Line-Comments.

        For example (I'm redoing this from memory, so forgive me if it's
not exact):

catch Baseball {A}
Quarterback();     # throws FootBall
catch Football {B}

        In this example, B would be called and A wouldn't.  OTOH:

catch Baseball {A}
Pitcher();     # throws Baseball
catch Football {B}

        A Baseball exception would be thrown but not caught.  No problem.


                                Dave



Reply via email to