Jonathan Scott Duff <[EMAIL PROTECTED]> writes:
> On Tue, Aug 15, 2000 at 04:12:17PM -0700, Peter Scott wrote:
> > >Would someone please enlighten me as to the purpose of 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'.
>
> On Tue, Aug 15, 2000 at 06:24:08PM -0600, Tony Olekshy wrote:
> > The "try" is not necessarily for Perl's sake. It's for the
> > programmer's sake. It says, watch out, some sort of non-local
> > flow control may be going on here. It signals intent to deal
> > with action at a distance (unwinding semantics).
>
> How important are the exceptions? What about putting them first?
>
> exceptions {
> # code that does exception handling
> }
> {
> # code that may throw exceptions
> }
>
> Note that's a two-block keyword.
Hm...
try {
# this
throw $that;
}
catch It {
# Do stuff
}
Has the advantage of reflecting the order in which things may actually
happen, whereas the two block thing doesn't.
--
Piers