[Stackless] Stackless API

Christian Tismer tismer at stackless.com
Thu Jan 29 20:42:32 CET 2004


Arman Bostani wrote:

> arman>> * If the tasklet has a single frame and it performs a python 
> "return",
> arman>>   the caller of tasklet.run gets the return value.
> 
> tismer> What is the caller. What is the caller?
> tismer> You might think that run() defines the caller. But run() is
> tismer> an artificial thing at the moment, just there to make sure
> tismer> that the spelled tasklet is run right now.
> tismer> We might have to re-consider run(), if it should carry semantics
> tismer> like being a real caller.
> tismer> Again, I need this discussion on the mailing list!
> 
> Yes, I consider the caller of run() to be the "caller".

Ok, what we in fact can do, and it makes sense, is
to keep the last return value inside of the dead tasklet.
A "caller" which has a reference to the tasklet, i.e. the
one that has called the run() method, can use t.tempval
if it likes to. It can also inspect t's flags, to figure out
whether the tasklet is done computing.
I think to go for this little change, because it doen't
need much work and doesn't change existing semantics.

...

> tom> The idea of a return value from a tasklet seems like a nonsense to me,
> tom> as there is no caller waiting for said value. If you want this kind of
> tom> behavior, pass the tasklet a channel, and have the last statement the
> tom> tasklet executes be:
> tom>
> tom>   resultChan.send(result)
...

> Assuming we go with the model I'm suggesting, the caller of
> tasklet.run() is "waiting" for a return value.  If its a scheduler
> calling tasklet.run, then it may have a policy to collect the return
> values from the tasklets it runs.

Right now, I'm a bit tending to be in favor of
the channel idea. Channels are cheap and clean.
But please don't stop, keep the discussion rolling.
My POV is of minor importance, since I have been
fiddling with this stuff for too long now.
My sight is distorted.

[still digesting the meat of this interesting discussion]

ciao & thx - chris
-- 
Christian Tismer             :^)   <mailto:tismer at stackless.com>
Mission Impossible 5oftware  :     Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9a     :    *Starship* http://starship.python.net/
14109 Berlin                 :     PGP key -> http://wwwkeys.pgp.net/
work +49 30 89 09 53 34  home +49 30 802 86 56  mobile +49 173 24 18 776
PGP 0x57F3BF04       9064 F4E1 D754 C2FF 1619  305B C09C 5A3B 57F3 BF04
      whom do you want to sponsor today?   http://www.stackless.com/

_______________________________________________
Stackless mailing list
Stackless at stackless.com
http://www.stackless.com/mailman/listinfo/stackless



More information about the Stackless mailing list