[plt-scheme] call/cc, set!, and fluid-let

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Tue Jun 14 09:31:41 EDT 2005

I have code similar to this:

(define foo 1)
(define (bar/set x)
  (let/cc k
    (set! foo x)
    (k foo)))
(define (bar/fluid-let x)
  (let/cc k
    (fluid-let ([foo x])
      (k foo))))

(define (zog)
    (display foo)
    (display (bar/set 2))
    (display foo)
    (display (bar/fluid-let 3))
    (display foo)))

(zog) ; => 12232

So, a fluid-let cannot do its business in the face of continuations.
And the (zog) shows that this is not top-level weirdness.

I am willing to accept that this is illegal. I'm just curious why.


Jay McCarthy <jay at cs.brown.edu>

Posted on the users mailing list.