On Wed, Aug 16, 2000 at 12:52:07PM -0700, Peter Scott wrote:
> At 09:29 AM 8/16/00 -0500, Jonathan Scott Duff wrote:
> >Let me draw another picture (with "try" and "catch" this time):
> >
> >         try {
> >             # code that may cause exceptions
> >         } catch {                       # catches ALL exceptions
> >             switch ($@->^_) {
> >                 case canFoo             { ... ; undef $@ }
> >                 case isa('IOError')     { ... ; undef $@ }
> >                 case isa('Oops')        { ... ; undef $@ }
> >             }
> >         }                               # implicit throw here if defined $@
> >
> >To signal that the exception was handled, the programmer undefs $@.
> >That way if the user wishes to do something when an exception occurs,
> >but not handle it, they just don't undef $@.
> 
> Well, this is the most credible proposal for using switch that I've yet 
> seen; but it forces the user to type the same piece of arcana into 
> practically every catch block.  I want the commonest case to be the 
> simplest and most readable, and 99% of every exception handling thing I've 
> written has gone something like (adjusting to new syntax):

Well, those of you writing "exception" RFCs be sure and include this
example in there somewhere (if it's relevant to your RFC of course).

I'm done thinking about exceptions now.

-Scott
-- 
Jonathan Scott Duff
[EMAIL PROTECTED]

Reply via email to