Lambda the Ultimate

inactiveTopic Simple explanation of Continuation Passing
started 5/3/2001; 1:14:16 PM - last post 5/6/2001; 11:33:35 PM
andrew cooke - Simple explanation of Continuation Passing  blueArrow
5/3/2001; 1:14:16 PM (reads: 2498, responses: 9)
Simple explanation of Continuation Passing
Very simple, clear explanation (if you grep Scheme). From chris.danx on c.l.f.
Posted to theory by andrew cooke on 5/3/01; 1:15:47 PM

andrew cooke - Re: Simple explanation of Continuation Passing  blueArrow
5/3/2001; 1:18:41 PM (reads: 1510, responses: 1)
Poking around a little, this site has further snippets (the parent of the previous link). Seem to be snippets from this book.

andrew cooke - Re: Simple explanation of Continuation Passing  blueArrow
5/3/2001; 2:11:43 PM (reads: 1567, responses: 0)
Wahey. Doug Ransom just posted this on Python continuations too.

Ehud Lamm - Re: Simple explanation of Continuation Passing  blueArrow
5/4/2001; 3:29:16 AM (reads: 1499, responses: 1)
I haven't checked it out myself yet, but I see Matthias Blume write this about it:

Arrrgggghhh! Someone re-invented the wheel all over again. And made it rectangular... (comp.lang.functional).

Judging from Matthias previous usenet posts, his views are usually sound.

andrew cooke - Re: Simple explanation of Continuation Passing  blueArrow
5/4/2001; 4:54:48 AM (reads: 1614, responses: 0)
I think that comment was about the Python implementatin rather than the original link.

Ehud Lamm - Re: Simple explanation of Continuation Passing  blueArrow
5/4/2001; 5:04:52 AM (reads: 1521, responses: 0)
I think that comment was about the Python implementatin rather than the original link.

Yes. That's what I meant to say.

Oleg - Re: Simple explanation of Continuation Passing  blueArrow
5/4/2001; 6:50:05 PM (reads: 1474, responses: 0)
As Christian Queinnec noticed, "I found an interesting use of continuations where a continuation is the thing that gets invoked when someone presses a web button." As he elaborated at ICFP'00, most of the web programming is actually done in a continuation-passing style (by people who often are not cognizant of that fact). Scheme can capture continuations and thus lets us write web applications in a direct style. The latter is usually clearer and more "direct".

http://youpou.lip6.fr/queinnec/WWW/Continuation.html http://youpou.lip6.fr/queinnec/Papers/webcont.ps.gz

The paper is wonderful, and merits its own discussion.

pixel - Re: Simple explanation of Continuation Passing  blueArrow
5/5/2001; 12:00:10 PM (reads: 1483, responses: 0)
As for me, i don't understand much what is the real difference between continuations and closures, at least from the language point of view (continuations for implementation is another matter)

Oleg - Re: Simple explanation of Continuation Passing  blueArrow
5/6/2001; 3:07:54 PM (reads: 1481, responses: 1)
Both closures and continuations capture the environment that was in effect at the time of their construction. That environment is restored when a closure or a continuation is invoked.

If you program in a direct style you expect that an application of a closure or a procedure will return, with the result. When you invoke a captured continuation however, you do not expect any result since an invoked continuation never returns. The difference is that between CALL and GOTO.

When you program in a continuation-passing style (CPS) you don't expect any procedure to return either. No call ever returns. In that case, the difference between closures and continuations disappears -- which is precisely the point of the CPS.

A continuation can be called a closure for "the rest of the program".

I must point out to a comprehensive and engrossing talk John C. Reynolds gave at the 2nd ACM SIGPLAN Workshop on Continuations (CW'97): "The discoveries of continuations".

http://www.brics.dk/~cw97/ProceedingS/06.ps.gz

This is a classical paper that deserves to be referenced in the corresponding section of LtU. Note that van Wijngaarden devised the continuation-passing style back in 1964, as a tool to eliminate all gotos and labels from Algol. It was this talk about redundancy of goto that inspired Dijkstra to consider practical aspects of programming without goto. As one participant remembers, "Dijkstra spent that evening [after the talk] constructing realistic examples of programs without goto's, which he scribbled on napkins at coffee break the next day." These napkins eventually turned into the famous letter to the editor.

Ehud Lamm - Re: Simple explanation of Continuation Passing  blueArrow
5/6/2001; 11:33:35 PM (reads: 1532, responses: 0)
This is a classical paper that deserves to be referenced in the corresponding section of LtU.

And indeed it was mentioned here in the past.