[squeak-dev] Scheme continuations vs Squeak continuations

Julian Fitzell jfitzell at gmail.com
Fri Jan 30 17:08:32 UTC 2009


I'm assuming this is caused by Squeak's lack of full block closures.

Does it work if you make "y" an instance variable instead of a local?

Julian

On Fri, Jan 30, 2009 at 6:02 PM, Stéphane Rollandin
<lecteur at zogotounga.net> wrote:
> hello list,
>
> I realized yesterday that my scheme implementation in Squeak failed to
> evaluate properly the so-called "mondo bizarro" code:
>
> (let ((y (call-with-current-continuation (lambda (c) c))))
>    (display 1)
>    (call-with-current-continuation (lambda (c) (y c)))
>    (display 2)
>    (call-with-current-continuation (lambda (c) (y c)))
>    (display 3)))
>
> ... which should display "11213"
>
> instead, it writes "11" then goes on forever printing "2"
>
> I wrote the equivalent code in Smalltalk:
>
> y _ Continuation currentDo: [:c | c].
> Transcript show: 1.
> Continuation currentDo: [:c | y value: c].
> Transcript show: 2.
> Continuation currentDo: [:c | y value: c].
> Transcript show: 3.
>
> and it appears the (wrong) behavior is the same.
>
> is anyone expert enough in continuations to help me fix this ?
>
> (the Continuation class used here is from Seaside)
>
>
> Stef
>
>
>
>



More information about the Squeak-dev mailing list