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

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Tue Jun 14 10:05:43 EDT 2005

Read fluid-let as "temporary assignment to be undone on every exit from 
this expression". -- Matthias


On Jun 14, 2005, at 9:31 AM, Jay McCarthy wrote:

>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
> 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)
>   (begin
>     (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
>
> -- 
> Jay McCarthy <jay at cs.brown.edu>
> http://jay.makeoutcity.com/
>



Posted on the users mailing list.