radix/effect — pull request #1 by radix (2014-06-09 04:53:13+00:00)
Title: Factor Twisted support out to a separate, optional module

This branch brings major factoring changes, with the main goal of separating the Twisted support into a separate optional module.

The core callback-running code was greatly simplified by the use of an asynchronous CPS-style trampoline, and some minor abstractions that allow us to deal with either synchronous or asynchronous effect handlers. In other words, I added some tools that allow us to deal with asynchronous handlers in general, instead of Twisted handlers in particular.

Even the "parallel" effect is able to stay in effects core, while its gatherResults-based implementation is in effects.twisted -- by way of the separating the default dispatchers for "standard" effects code and "twisted" effects code. In order to make this simple to use, I added an 'effects.twisted.perform' top-level effect-performing function, which uses the twisted_dispatcher by default.

(oh yeah, and I moved effect.Effect.perform to a toplevel function, effect.perform, along with a lot of other functions).