[plt-scheme] call/cc and space

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Wed Jun 15 17:18:04 EDT 2005

On Jun 15, 2005, at 4:44 PM, David Van Horn wrote:

>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
> The recent mention of space safety made me revisit R5RS.  Is my 
> understanding correct in that the following should use a bounded 
> amount of memory?
>
> (let loop () (call/cc (lambda (k) (loop))))
>
> R5RS requires call/cc to apply it's argument in a tail position, and 
> the call to loop is in a tail position within that procedure.

Sure, the _control_ space should not grow at all. But that doesn't mean 
that space consumption shouldn't grow. Consider

  (let loop ([n LARGE-NUMBER]) (loop (* LARGE-NUMBER LARGE-NUMBER)))

Clearly, space consumption will grow but control space consumption 
won't.

> The callcc example grows in MzScheme, although not in Petite Chez.

And that explains that. -- Matthias

P.S. Until you can show that control space consumption grows in 
MzScheme.



Posted on the users mailing list.