[racket-dev] Changing call/cc

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Thu Aug 30 09:59:57 EDT 2012

At Thu, 30 Aug 2012 09:34:09 -0400, Asumu Takikawa wrote:
> On 2012-08-30 06:53:58 -0600, Matthew Flatt wrote:
> > That variant is called `call/cc-via-composable' in the tests. It's
> > meant for use with `call-with-continuation-prompt-for-composable',
> > which is why there is an extra `call-with-continuation-prompt'.
> I think you may want the extra prompt in there, because a `call/cc`
> currently does not drop the prompt when it installs the new
> continuation. On the other hand, after the abort handler is run, the
> prompt is discarded.

The default abort handler keeps the prompt (i.e., it installs a prompt
with the same tag as the abort target) when it runs a thunk that is
supplied to the abort.

> The example that would break uses `call/cc` and delimiters to implement
> `amb`. [...]
> The abort handler here isn't prepared to deal with thunks that it would
> receive from an emulated `call/cc`.

Ok, it makes sense that we'd have to break that example.

> > I think this combination of replacing both `call/cc' and `dynamic-wind'
> > would be equivalent to a smaller change to the semantics of `call/cc',
> > which is that it behaves as it does now if there's a shared
> > `dynamic-wind' between the source and target continuations, but it
> > behaves like your replacement `call/cc' if there's no intervening
> > prompt (which addresses the reasoning problem). Also, implementing the
> > change directly in the existing `call/cc' implementation sounds fairly
> > easy to me.
> Did you mean behaves like the replacement if there *is* an intervening
> prompt?

Sorry --- I meant "if there is no shared `dynamic-wind' before the

Posted on the dev mailing list.