Re: Try Finally...
From: Martin Harvey (Demon account) (martin_at_nospam_pergolesi.demon.co.uk)
Date: 10/25/04
- Next message: Martin Harvey (Demon account): "Re: Try Finally..."
- Previous message: Martin Harvey (Demon account): "Re: A GOOD book wanted."
- In reply to: Duncan McNiven: "Re: Try Finally..."
- Next in thread: L D Blake: "Re: Try Finally..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 25 Oct 2004 18:14:58 GMT
On Mon, 25 Oct 2004 14:45:10 +0100, Duncan McNiven
<duncan@mcniven.net> wrote:
>No it won't. It will continue at the next outer try .. finally or try
>... except construct. Since you haven't provided one, execution goes to
>the application's default exception handler, and terminates there.
I'm amazed you folks are even having this argument. It's real simple.
The only real difficuly that is going on is understanding the
different viewpoint between language constructs and S.E.H. constructs.
try ... except and try...finally are both the same thing in S.E.H.
terms:
They both create and register an exception handling "callback
function" which is the body of the "finally" or "except" block. These
blocks are chained together in effectively the same order as the
stack.
when an exception is raised, the records are traversed and the stack
is unwound. Now, I'm going to skip the details of the fact that the
entire chain is traversed twice, and will simply say that the
difference is that with a "finally" block, the default behaviour is to
continue the unwind process (resulting in possible termination of the
program, and with an "except" block, the default behaviour is to
indicate that the exception has been handled, and it is possible to
continue.
Now ... as concerns continuing versus not continuing.... there are
several points where confusion may be present, and I'll attempt to
clear this up.
- Skipping the subtleties, if I remember rightly, there are basically
three things that an S.E.H registered handler can do
- continuing the program because the exception has been handled.
- continuing the search for an appropriate handler.
- stopping the whole shebang at that point, and terminating the app.
If LDB wants to implement a custom mechanism, the thing one should be
doing with finally blocks is NOT terminating the program, but
continuing the search. HOWEVER, this may well require some custom code
to unwind the stack.
Oh, and BTW, I'd recommend people who don't know how S.E.H works
internally at least do a google search and a bit of reading - it's
quite interesting.
MH.
- Next message: Martin Harvey (Demon account): "Re: Try Finally..."
- Previous message: Martin Harvey (Demon account): "Re: A GOOD book wanted."
- In reply to: Duncan McNiven: "Re: Try Finally..."
- Next in thread: L D Blake: "Re: Try Finally..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|