[Stackless] Continuations in stackless

Grant McDonald gmcdonald at infocomp.com
Sat May 20 08:19:38 CEST 2006


Chris,

Speaking of texts, how is your book coming along?

Grant

-----Original Message-----
From: stackless-bounces at stackless.com
[mailto:stackless-bounces at stackless.com]On Behalf Of Christian Tismer
Sent: Saturday, 20 May 2006 7:54 AM
To: olsongt at verizon.net
Cc: stackless at stackless.com
Subject: Re: [Stackless] Continuations in stackless


Hi!

> The wikipedia definition for continuations says this about stackless:
> 
> used to have a continuation module, but it has been removed.

This is true.

> I was going to update the entry, but my theory isn't the best.
> Calling 'stackless.schedule()' in the middle of a function
> creates a continuation, right? Or am I abusing the term?

The definition of continuation is not really unique.
I tend to use it meaning "full continuation"s.

A full continuation is an immutable object that can be
started as many times as you like, with no limits and
all the consequences most people aren't aware of.

One consequence is that the very same running function
invocation can be running many times in parallel, operating
on the same variables. Also, it is possible to return from the
same function call as many times you like, at any time
in the future.

If you think this is trivial, then you missed the point.
It is easy to miss it. The power of full continuations
is frightening!

This is what the first version of Stackless Python supported.
And the reason why I abandoned it was that nobody really
understood it, including myself. :-)

stackless.schedule freezes the current tasklet and passes
control over to a different tasklet. This is sometimes
called "one-shot continuation"s. There are continuations
involved, if you like to see it this way, but they are
short-lived. They stop to exist after they got reactivated.
In so far, they are not much different from those continuations
which you implicitly have all the time when a function
gets suspended while you are calling a different function.
We just don't use the C stack to store the state.

The tiny difference is order of execution: While the function
call dictates the order of execution by exactly the reversal
of invocation, the tasklet removes this promise and allows
you to switch to a different tasklet instead of immediately
running it to the end.

This is a very mild, easy to undertand version of continuations,
and I think it hardly deserves this name.

If you think I should write a few words for wikipedia, I'm happy
to do so, but I'm evenly fine if you are writing a good text.

cheers & thanks -- chris
-- 
Christian Tismer             :^)   <mailto:tismer at stackless.com>
tismerysoft GmbH             :     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 802 86 56  mobile +49 173 24 18 776  fax +49 30 80 90 57 05
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.stackless.com/pipermail/stackless/attachments/20060520/cb981ee5/attachment.htm>
-------------- next part --------------
_______________________________________________
Stackless mailing list
Stackless at stackless.com
http://www.stackless.com/mailman/listinfo/stackless


More information about the Stackless mailing list