[racket-dev] Changing call/cc

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Wed Sep 5 19:27:10 EDT 2012

At Tue, 4 Sep 2012 06:51:49 -0600, Matthew Flatt wrote:
> Yes, that's true. I don't think there will be a difference for typical
> uses of `call/cc' and typical abort handlers, though. And as I
> understand it, we're not at this point trying to make `call/cc' work
> seamlessly, but instead support it reasonably well for backward
> compatibility.

It turns out that non-default abort handlers are more common than I
thought: every module-level form is wrapped with a prompt whose handler
re-aborts to an enclosing prompt. So, relying on default-like behavior
of a prompt handler doesn't work in that case, and it seems like a
prominent case.

(The `module' form was misdocumented on this point. I've fixed the
documentation. Not realted to that change, but related to the rest of
this thread: I changed the initial prompt for each thread to use the
default handler, instead of ignore all abort arguments.)

I think it would make sense to add a new argument to
`call-with-continuation-prompt' that handles continuation applications.
That addition would allow a use of `call-with-continuation-prompt' to
enforce invariants on its result --- although it seems awkward to add
support for a feature that we'd prefer to get rid of.


Posted on the dev mailing list.