Matt Fowles <[EMAIL PROTECTED]> wrote:... Why not just make exception handlers a second continuation passed to all functions.
... because it is answered in a f'up to a similar proposal by our summarizer:
,--[ leo ]----------------------------------------------------------- | What about C code that either installs exception handlers or throws | exceptions? `--------------------------------------------------------------------
Before calling C code parrot could install an exception handler, if that handler is used parrot could call the appropriate continuation. Similarly, after C code that installs an exception handler, parrot could create a new continuation that would jump into the installed handler when called.
,--[ dan ]---------------------------------------------------------------- | Or multiple nested exception handlers, or serial exception handlers in a | block... And then there's the fun with exception handlers and | coroutines. `-------------------------------------------------------------------------
Nested exception handlers would be handled exactly the same way nested function calls are handled by continuations. The inner exception continuation would store the outer one in a register which it new about and then call it. I am not entirely sure what is meant by serial exception handlers. If it just means
try { ... } catch(FooException fe) { ... } catch(BarException be) { ... } catch(Exception e) { ... }
This can be handled compiler side, by attaching/checking properties to/on the exception continuation.
Matt