[plt-scheme] call/cc behavior in gambit-c vs. plt-scheme

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Wed Jun 11 07:53:19 EDT 2008

Now add (coco 14) to the begin sequence. -- Matthias


On Jun 11, 2008, at 6:29 AM, Cristian Baboi wrote:

> I think you are right. I tryed this:
>
> (define (call/ccc x) (call-with-current-continuation x))
>
> (define coco 1)
> (define (run)
>  (begin
>   (display "begin") (newline)
>   (call/ccc (lambda (c) (set! coco c)))
>   (display "again") (newline)
>   (display "end") (newline)
>  )
> )
>
>
> (run)
> (coco 13)
>
> and this time I've got:
> - mzscheme:
> begin
> again
> end
> again
> end
>
> - gambit-c:
> begin
> again
> end
> again
> end
> again
> end
> again
> end
> again
> end
> ....
>
>
>
> On Wed, 11 Jun 2008 13:03:06 +0300, Filipe Cabecinhas  
> <filcab at gmail.com> wrote:
>
>> Hi,
>>
>> I'm no expert, but I'll give you my interpretation.
>>
>> I think the difference is because mzscheme has a delimited  
>> continuation at the top-level so you can't capture anything beyond  
>> that with call/cc. And I suppose it will also "merge" the begin  
>> with the top-level (making it a no-op) so you won't even get the  
>> "again\nend" twice.
>>
>> But you better wait for a reply from someone that knows mzscheme  
>> better :-)
>>
>>    - Filipe Cabecinhas
>>
>
>
> ________ Information from NOD32 ________
> This message was checked by NOD32 Antivirus System for Linux Mail  
> Servers.
>  part000.txt - is OK
> http://www.eset.com
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme



Posted on the users mailing list.