On 2012-05-31 08:39, Jonathan M Davis wrote:

No. I haven't been arguing that. It's not particularly safe to catch Errors,
but they're catchable on purpose. It's catching and _handling_ an Error that's
generally a bad idea - that and continuing to execute after catching the Error
rather than letting the program terminate. It may be appropriate in very rare
examples where the programmer knows what they're doing, but in general,
catching them to do much beyond print out additional information or maybe do
some absolutely critical cleanup is a bad idea.

The real question is whether any cleanup should be attempted on Error (i.e.
destructors, scope statements, and finally blocks). Running that code is risky
when an Error occurs, because the program is in an invalid state. It's
possible that running it could actually do damage of some variety, depending
on the state of the program and what the cleanup does. But skipping all of
that cleanup can be a problem too, since that cleanup generally needs to be
done. Depending on what the Error was, the cleanup may actually work and
therefore leave the program in a less invalid state. So, it's a question of
whether attempting cleanup in an invalid state or skipping cleanup in an
invalid state is riskier. Per Walter, there's no guarantee that that cleanup
will occur, but with the current implementation it almost always does.

Ok, I'm sorry if I misunderstood you or confused you with someone else.

--
/Jacob Carlborg

Reply via email to