Re: Try Finally...
From: Maarten Wiltink (maarten_at_kittensandcats.net)
Date: 10/26/04
- Next message: Maarten Wiltink: "Re: Try Finally..."
- Previous message: Maarten Wiltink: "Re: Try Finally..."
- In reply to:(deleted message) L D Blake: "Re: Try Finally..."
- Next in thread: L D Blake: "Re: Try Finally..."
- Reply:(deleted message) L D Blake: "Re: Try Finally..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 26 Oct 2004 10:45:12 +0200
"L D Blake" <not@any.adr> wrote in message
news:ej8rn01903rqqfn8b7sbrt3lstntt0sko8@4ax.com...
[...]
> The first shortcoming, in fact the reason I joined this group, has
> already been explained in some depth... Try/Except handling shuts
> down if the SysUtils unit is not loaded. There is no error message,
> no syntax error, nothing... it just stops working. THAT can be a
> serious problem if you aren't expecting it... Reserved Words should
> not just shut down.
This, I agree with. It may have been a feeble attempt on Borland's
part to allow programmers to keep their applications slightly leaner.
But it's not a very good way, although it's easy, and the cost is out
of proportion to the benefits.
[...]
> See that's just it... Finally doesn't handle the actual exception and
> thus it *must not* unwind the stack.
I'm not sure about this. Exceptions "climb out" through the call chain,
executing finally and except clauses along the way, and execution
finally continues at the point where the exception is handled. That
suggests that unwinding the stack is the right thing to do along the
way.
If I've understood correctly, the Windows mechanism takes a two-stage
approach, with the first stage only following the stack and the second
one unwinding it. Why it's done this way, I don't understand. Delphi
appears to have collated these two stages into a single one, bypassing
Windows' code. I don't consider this bad in itself; it's just different.
The final effect is the same: all the right code gets executed, and
execution finally continues after the handler that handles the exception.
[...]
> Reading the code, one gets the impression that Borland's guys really
> didn't understand how SEH works... Hell knows I had a rough enough
> time wrapping my head around it and it's not very well documented to
> begin with. They've invested a LOT of code in what looks for all the
> world to be an attempt to create the entire concept within Delphi
> rather than using the windows provided mechanism. (Same thing they
> did with their memory manager)
More likely Borland's guys wanted something Windows couldn't offer them:
exception _objects_. So they built their own stack unwinding, using the
data structures that Windows keeps, and adding their own behaviour on
the side.
That you don't care for this feature doesn't mean it's irrelevant to
other people. Having exceptions be objects does have its benefits, even
if you don't use it every day, or even if you specifically don't use it
at all.
Groetjes,
Maarten Wiltink
- Next message: Maarten Wiltink: "Re: Try Finally..."
- Previous message: Maarten Wiltink: "Re: Try Finally..."
- In reply to:(deleted message) L D Blake: "Re: Try Finally..."
- Next in thread: L D Blake: "Re: Try Finally..."
- Reply:(deleted message) L D Blake: "Re: Try Finally..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|