[plt-scheme] Fun with Unicode and delimited continuations

From: Sam Tobin-Hochstadt (samth at ccs.neu.edu)
Date: Fri Jun 4 13:45:49 EDT 2010

On Fri, Jun 4, 2010 at 1:36 PM, Matthias Felleisen <matthias at ccs.neu.edu> wrote:
>
> On Jun 4, 2010, at 1:32 PM, Sam Tobin-Hochstadt wrote:
>
>> ... even outside the context in which they're captured.
>
> You're right. They are not escape continuations.
>
> How are they one-shot if you can escape from the context where you captured them? Did you or did you not use the continuation to exit from that context?

They're one-shot in that they can only be invoked once - after that,
they change to do something else.  Consider this implementation of
`call/cc':

(define (call/cc* f)
  (let/cc k
    (let* ([v #f]
            [k* (lambda (e) (if v (error 'too-many) (begin (set! v #t) (k e)))])
      (f k*))))

This implements a first-class, full continuation that can only be used
once.  You can pass it back out, invoke it from anywhere, but after
one use it errors.  That's a one-shot continuation.

> (My true point is that they aren't continuation at all. You can use continuations in the denotational sense to explain them but I think you can get away with something much much simpler: procedure-local continuations, and they are NOT first-class.)

You can explain them as coroutines, as the paper I pointed to does.
-- 
sam th
samth at ccs.neu.edu


Posted on the users mailing list.