On Sun, Sep 25, 2005 at 11:32:54 -0600, Luke Palmer wrote:

> Exactly which exception is continued?
...
> This comes up again with open().  So it's somewhere in between.
> Where?

For the open() example I don't have a solution but I know in what
direction to throw it: the same thing that makes croak appear to
work from the caller =)

Several things come to mind... First is this: (ugly)

        sub open {
                ...
                CATCH { fail $! }; # force it to go up
        }

This is the most flexible, but also the crudest method.

Another idea is to use the same namespace hopping logic that Carp
does right now. This doesn't work for exceptions in the same class
so it should be optional and off by default... Perhaps:

        fail "error" :package_boundry; # better word needed

Another idea is to use a lexical pragme that delays all errors,
which is like CATCH { fail $! } but more declarative:

sub open {
        use fatal <propagate>;
        ...
}

For when it isn't specified, when doing evil things such as stepping
into the continuation of an exception, we assume that the code doing
the CATCH knows about the code that raised the exception at least
something.

Encapsulation is sort of maintained by specifying what kinds of
operations are fixed.. For example, errors having to do with opening
files are fixuppable by taking the arguments to open found in the
exception, and trying to reopen the file after some fudging, and
returning a handle. This is common knowlege about the interface of
open, and we are simply saying that for the rest of the dynamic
scope (dangerous, perhaps) we are trying to fixup every call to open
that fails with this handler.

This is no different than catching that exception in terms of
encapsulation, except that the failure is defatalized. My claim is
that just as you know the kind of error it is when you explicitly
catch it for the purpose of reporting, you have the same knowlege
when you are fixing.

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

Attachment: pgpCOTXugoPT2.pgp
Description: PGP signature

Reply via email to