Resumable exceptions bad:

Mark Wooding mdw at distorted.org.uk
Mon Dec 6 16:23:06 EST 2010


John Nagle <nagle at animats.com> writes:

> Resumable exceptions were a popular idea in the early days of
> programming.  LISP, PL/I, and early COBOL had constructs which could
> be considered resumable exceptions.  They didn't work out well,
> because the exception handler gets control in an ambiguous situation,
> perhaps in the middle of an expression.  Changing the state of the
> execution, then returning, can leave the program in an invalid state.

Right, but that's not the important really important trick.  The
important bit is separating out the `how should I fix this?' logic from
the point where execution should resume.  There's no good reason why the
former should have to come from a dynamic context smaller than the
latter: it's just an unnecessary conflation.

[Snip stuff about signals.  I agree that Unix signals are a disaster.]

> So that's why resumable exceptions are a bad idea.

That's why a primitive resumable exception system, used naively, is a
bad idea.  Now look at the good ones.

-- [mdw]



More information about the Python-list mailing list