[racket] call/cc unexpected behavior in interaction window

From: Laurent (laurent.orseau at gmail.com)
Date: Tue Sep 7 06:15:29 EDT 2010


(this is somewhat related to bug report `all/11165' )

I'm not sure this is a bug since the interaction window is something
quite different from the execution of a program, but the following does
weird things.

#lang racket

(define x #f)
(define r #f)

(set! x
 (call/cc (lambda(k)
            (set! r k)
            (k 3))))

(displayln x)
(r 4)
(displayln x)
(r 5)
(displayln x)

This is ok and prints 3, 4 and 5.
Now go to the interaction window:
> x
> r
> (r 6)
> x
> r

It looks like its sets r instead of x.

Even if the interaction window has its own prompt,
the previous example looks odd to me.
Can anyone enlighten me?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20100907/09fbdb3b/attachment.html>

Posted on the users mailing list.