Continuation Passing Style Revisited Part Five: CPS and Asynchrony

Today is when things are going to get really long and confusing. But we’ll make it through somehow. Consider the following task: you’ve got a list of URLs. You want to fetch the document associated with each URL. (Let’s suppose for the sake of argument that this always succeeds.) You then want to make a…

18

Continuation Passing Style Revisited Part Four: Turning yourself inside out

The obvious question at this point is: if CPS is so awesome then why don’t we use it all the time? Why have most professional developers never heard of it, or, those who have, think of it as something only those crazy Scheme programmers do? First of all, it is simply hard for most people…

6

Continuation Passing Style Revisited Part Three: Musings about coroutines

Last time I sketched briefly how one might implement interesting control flows like try-catch using continuations; as we saw, the actual implementations of Try and Throw are trivial once you have CPS. I’m sure that you could extend that work to implement try-catch-finally. Or, another basic exercise when learning about CPS you might try is…

20

Continuation Passing Style Revisited Part Two: Handwaving about control flow

Last time on Fabulous Adventures: “But we can construct arbitrarily complex control flows by keeping track of multiple continuations and deciding which one gets to go next.” Let’s look at an example of something more complex than a conditional. Consider a simplified version of “try-catch”, where there is no expression to the throw. A throw…

25

Continuation Passing Style Revisited, Part One

Good morning fabulous readers, let me just start by saying that this is going to get really long and really complicated but it will all pay off in the end. I’m also going to be posting on an accelerated schedule, more than my usual two posts per week. (It’ll eventually become clear why I’m doing…

31