paul@57 | 1 | Exception Handling
|
paul@57 | 2 | ------------------
|
paul@57 | 3 |
|
paul@109 | 4 | An exception handler stack is defined such that when a try...except or
|
paul@109 | 5 | try...finally block is entered, a new handler is defined.
|
paul@57 | 6 |
|
paul@109 | 7 | When an exception is raised, the program jumps to the most recently defined
|
paul@109 | 8 | handler. Inside the handler, the stack entry for the handler will be removed.
|
paul@57 | 9 |
|
paul@109 | 10 | Depending on the nature of the handler and whether the exception is handled,
|
paul@109 | 11 | the program may jump to the next most recent handler, and so on.
|
paul@57 | 12 |
|
paul@109 | 13 | If no handler is defined when an exception is raised or re-raised, the program
|
paul@109 | 14 | should terminate. This might be done by having a "handler #0" which explicitly
|
paul@109 | 15 | terminates the program.
|