Message: 2 Date: Tue, 23 Oct 2012 12:48:39 +1300 From: Greg Ewing firstname.lastname@example.org To: "email@example.com" firstname.lastname@example.org Subject: Re: [Python-ideas] yield from multiple iterables (was Re: The async API of the future: yield-from) Message-ID: 5085DB57.email@example.com Content-Type: text/plain; charset=UTF-8; format=flowed
It does, in the sense that a continuation appears to the Scheme programmer as a callable object.
The connection goes deeper as well. There's a style of programming called "continuation-passing style", in which nothing ever returns -- every function is passed another function to be called with its result. In a language such as Scheme that supports tail calls, you can use this style extensively without fear of overflowing the call stack.
You're using this style whenever you chain callbacks together using Futures or Deferreds. The callbacks don't return values; instead, each callback arranges for another callback to be called, passing it the result.
There is a really nice Microsoft Research called "Cooperative Task Management without Manual Stackless Management." In this paper, the authors introduce the term "stack ripping" to describe how asynchronous events with callbacks handle memory.
I think this is a nice way to describe the fundamental differences between continuations and Twisted callbacks/deferred.