Video on Continuations

I thought I'd let you all know about a video lecture I gave on Scheme continuations, and how they can be used to generate all sorts of control structures. Enjoy!

Continuations: The Swiss Army Knife of Flow Control

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

call/cc and dynamic-wind

Re the talk itself: I enjoyed it. The illustration of the stack made me very thoughtful; I've meditated a lot over the years (and observed what others have tried) about how to illustrate how continuations work, and this was an interesting approach. One thing that frustrated me was that the visuals didn't show the value as it was passed up the stack, so the accumulating result as it worked its way up the stack was invisible until the 24 appeared at the end.

Even though I love that Scheme has continuations, I was appalled by the way the R5RS did dynamic-wind —when I read that if you call an external continuation from inside a guard procedure the consequences are undefined, I basically said, seriously?— so I pointedly designed Kernel to do guarded continuations right. Along the way, I also straightened out the sloppy conflation of continuations with procedures, and it fell out naturally that call/cc is a library feature in Kernel. Really, call/cc is a rather esoteric (cf. INTERCAL) way to construct continuations; when combined with guarded continuations, it means that, given a continuation, you can't add a child to it without actually entering the dynamic scope of the parent, thus triggering all the continuation guards between your current continuation and the prospective parent, half of them on the way to the parent so you can add the child, and then the other half on the way back after doing so.