On Wed, Oct 05, 2005 at 13:41:37 -0700, Dave Whipp wrote: > Reading this thread, I find myself wondering how a resumable exception > differs > from a dynamically scropted function. Imagine this code:
This is sort of like what I mean, except that there is no encapsulation breakage, since the interface is inverted. The advantage of this approach is that error handling code in a submodule can benefit from generic, reusable exception handling code that is provided by it's caller. > temp sub FileNotWriteable( Str $filename ) { With an exception handler and continuable exceptions you don't have to know what the error handler is, or make sure that the module actually throws the error. The exception handler instead deals with the type of the exception in a generic manner (it doesn't care when the exception was actually generated). The module doesn't need to throw the error it just needs to fail (or delegate a fail), until the failure crosses into a 'use fatal' scope. That way both the catching code and the throwing code are reusable and orthogonal when they are unrelated, but the possibility of coupling handling code with throwing code is still there. -- () Yuval Kogman <[EMAIL PROTECTED]> 0xEBD27418 perl hacker & /\ kung foo master: /me groks YAML like the grasshopper: neeyah!!!!!!
pgpzo38NCmZ47.pgp
Description: PGP signature