[Stackless] Re: [Zope-dev] Zope 2.7 running with Stackless 3.0
Shane Hathaway
shane at zope.com
Thu Sep 4 00:40:40 CEST 2003
[I'm sorry, Aaron Watters, that you thought I was leading Chris on. I'm
only trying to cheer up Chris and help him get back on his feet. Now
back to the Stackless discussion.]
Bob Ippolito wrote:
> On Wednesday, Sep 3, 2003, at 16:12 America/New_York, Jim Bowery wrote:
>
> Someone who thinks there should be more allowance for indeterminate
> order of evaluation in highly threaded applications.
>
>
> Twisted ( http://www.twistedmatrix.com/ - website might still be moving
> though ) does this to an extent with Deferreds (aka promises/futures, I
> think), but it's based on a single threaded reactor pattern (with
> threads/threadpools if you need them for specific tasks) and doesn't
> have the luxury of stackless to speed up and simplify things. Each
> Deferred object is a chain of callback/failure pairs, but they're not
> transparent. Acquiring the value or failure from a Deferred is only
> possible through the callback/errback callback chain, it will never
> morph into the value object if you try and use it like one (not
> transparent). This is good and bad, but it can be done with mainline
> Python without new syntax or even generators (when you use generators
> with Deferreds you pretty much go back to synchronized land, so they're
> not good for much other than syntax in Twisted).
As I see it, Twisted goes to great effort to make it possible to defer
all I/O to a reactor. Stackless practically eliminates the difficulty
of doing that. Therefore, if Twisted used Stackless, Twisted would be
significantly simpler and probably faster.
FWIW... I came to understand this concept when generators were added to
Python. At first, I wondered by anyone thought they were useful; after
all, you can do exactly the same thing by writing a class instead of a
function and storing all state as instance attributes. Then I saw how
much simpler and shorter a generator could be. I realized that the
transformation from generator to class is very similar to the
transformation from synchronous I/O to asynchronous I/O. Wouldn't it be
nice to be able to write synchronous code, then use it asynchronously?
Yay Stackless!
Shane
_______________________________________________
Stackless mailing list
Stackless at www.tismer.com
http://www.tismer.com/mailman/listinfo/stackless
More information about the Stackless
mailing list