[racket-dev] Changing call/cc

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Tue Sep 4 08:51:49 EDT 2012

At Thu, 30 Aug 2012 11:36:55 -0400, Asumu Takikawa wrote:
> On 2012-08-30 06:53:58 -0600, Matthew Flatt wrote:
> > 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.
> 
> Sam and I discussed this some more, and we think it sounds workable and
> will go and try to add it to the Redex model and see what tests fail. We
> were concerned about one thing though: it sounds like this would modify
> the behavior of `call/cc` depending on whether or not you put a
> `dynamic-wind` in your continuation.
> 
> That also means that a programmer who installs a `dynamic-wind` might
> get fewer abort handlers run than expected, or perhaps gets *more* run
> than expected since they either didn't install the `dynamic-wind` or
> they passed the continuation out of the `dynamic-wind` to a different
> context and invoked it there.
> 
> Is that a fair point or are we misunderstanding your proposed semantics?

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.


Posted on the dev mailing list.