On Mon, Sep 26, 2005 at 17:40:52 +0100, Piers Cawley wrote:
> Luke Palmer <[EMAIL PROTECTED]> writes:
> 
> > On 9/25/05, Yuval Kogman <[EMAIL PROTECTED]> wrote:
> >> I propose a new model - each exception has a continuation that
> >> allows it to be unfatalized.
> >
> > I think we've already talked about something like this.  But in the
> > presence of "use fatal", it makes a lot more sense.
> >
> > Something comes to mind:
> >
> >     use fatal;
> >     sub foo()  { bar()  }
> >     sub bar()  { baz()  }
> >     sub baz()  { quux() }
> >     sub quux() { fail }
> >     {
> >         say foo();
> >         CATCH { $!.continue(42) }
> >     }
> >
> > Exactly which exception is continued?
> 
> The bottommost one. If you want to return to somewhere up its call chain, do:
> 
>   $!.caller(n).continue(42)

This breaks encapsulation, like luqui mentioned.

However, since every exception has an exception stack, i guess you
could see exactly how it was propagated non-fatally, before it was
actually thrown.

>   sub open(...) {
>     ...
>     CATCH { $!.rethrow }
>   }
...
>    $!.inner


That way behavior like that could be automated

-- 
 ()  Yuval Kogman <[EMAIL PROTECTED]> 0xEBD27418  perl hacker &
 /\  kung foo master: /me sushi-spin-kicks : neeyah!!!!!!!!!!!!!!!!!!!!

Attachment: pgpffVTkcoASG.pgp
Description: PGP signature

Reply via email to