[plt-scheme] Behind the scenes, is everything running using continuation passing style?

From: Ryan Culpepper (ryanc at ccs.neu.edu)
Date: Wed Nov 14 14:43:39 EST 2007

On Nov 14, 2007, at 9:38 AM, Matthias Felleisen wrote:
> [...]
> ;; ---
> When you do implement call/cc with cps, you give up the "native" 
> stack. Doable but a high cost for integrating with the rest of the 
> world. As SK points out and I emphasize :-), the best synthesis is to 
> map cps continuation manipulations into small "native" stack 
> operations. Dybvig and Hieb's strategy of lazily copying the stack is 
> by far the best. Clinger has an excellent survey paper on the topic, 
> comparing different strategies, their [dis]advantages and benchmarks.
> But of course, you really have to believe that call/cc and friends are 
> essential to go through all this work.

Going through that (substantial) work does have another benefit. If you 
implement contexts in a way that supports call/cc, you often also avoid 
artificial limits on the size of your contexts ("for free"). That is, 
no "Stack overflow" or "Recursion limit exceeded" errors. I would rank 
elimination of artificial stack limits up there with proper tail 
recursion in terms of supporting clean program structure.


Posted on the users mailing list.