[Stackless] stacklesslib.async

Richard Tew richard.m.tew at gmail.com
Tue Sep 3 01:05:46 CEST 2013

I think this general sort of functionality has long been needed in
Stackless, and it brings up the old sawhorse of why are we not
including stacklesslib in Stackless distribution.  But let's ignore
that for now.

I like the idea of having a standard well received API from another
popular language, that people can just pick up and use with
approximately same namespace - even if the coding standards for this
specific API conflict with the rest of the package.

That said I don't get the API.  It seems badly designed.

To me, not having looked at the C# API much, I expect waitAll and
waitAny should return the result of the tasks that completed with the
index of each in the list.

[ (0, text), ] = x.waitAny([ t1, t2 ])

And whenAll and whenAny should imply there's a result, but not pull it.

[ 0 ] = async.whenAny([ t1, t2 ])

Then again, why return indexes.  That just means you have to waste
time holding onto the original list, if you do not have a permanent

But I think that this should not just handle tasklet completion, it
should also handle tasklets producing results via channels.  In that
case, it is useful to poll whether any tasklets have results, rather
than waitX with a minimum timeout.

I think that this should be in, but there surely can be a more natural
fit.  And this might mean a requirement for lower level support.

And having written all this, the elephant in the room is that I
believe CSP, which Andrew Francis has long been advocating, is closer
to what I think we need.  However, I've long had problems with using
it ad hoc, as I think it is not that user friendly and is more
theoretically balanced than functionally balanced.


More information about the Stackless mailing list