[racket] Implementing delimited continuations using a CPS transform

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Thu Nov 24 10:01:11 EST 2011


On Nov 24, 2011, at 9:52 AM, nicolas.oury at gmail.com wrote:

>> But you could also break the tail-call discipline of CPS and translate [shift e] as \k. (k [e](\x.x))
>> Or you can use our 'abstract' continuations to manipulate a stack of continuations directly.
> 
> What are your 'abstract' continuations? Sounds very interesting.


See LFP 1988. When I first invented prompts and functional continuations, I did not know how 
to assign a denotational meaning to them, i.e., a translation from syntax to sets of denotations. 
Or how to write a TCO interpreter that has the right properties. The key insight was that you
don't have to have monolithic functions as continuations with just one operation on them 
(composition). Instead you can use any ordinary algebra of combinators that combine small
pieces (functions) into the whole thing (continuation) and use them (throw). Best of all, 
if you look at the initial model of a simple stack algebra, you get the standard notion
of continuations and if you look at the final interpretation, you get a stack of functions, 
which you can then use to do prompts/F prompts/C prompts/callcc. One of these combinations is
shift/reset, as reinvented by them. I forgot which one. -- Matthias




Posted on the users mailing list.