[racket] prompts and aborts

From: Danny Yoo (dyoo at cs.wpi.edu)
Date: Mon Sep 6 15:59:37 EDT 2010

I'm a little confused by the tail behavior I'm seeing in
call-with-continuation-prompt and abort-current-continuation.  Here's
my test code:

#lang racket

(provide (all-defined-out))

(define (f)
   (lambda ()
     (abort-current-continuation (default-continuation-prompt-tag)
                                 (lambda ()
   (lambda (thunk)

(define (f2)
   (lambda ()
     (abort-current-continuation (default-continuation-prompt-tag)
                                 (lambda ()

(I know this is fairly useless code, but I'm using it to test my
implementations of continuation prompts in WeScheme.)

I expect both f and f2 to define infinite loops that consume bounded
stack space.  I expect this because, for f, the definition of
call-with-continuation-prompt says that the handler for any aborts
gets called in the same tail-calling context as
call-with-continuation-prompt.  For f2, I expected the same behavior.

Under DrRacket 5.0.1 (as well as under regular console racket), I'm
seeing that f has bounded memory, but f2 seems to use unbounded
memory.  Why does f2 consume memory?

Posted on the users mailing list.