[Stackless] Continuations in stackless
Christian Tismer
tismer at stackless.com
Sun May 21 00:37:34 CEST 2006
Grant Olson wrote:
...
>> And the reason why I abandoned it was that nobody really
>> understood it, including myself. :-)
>>
>
> Glad to see I'm not the only one. ;-)
>
> I'm still digesting this, but I see a "full continuation" as sort of a
> "fork-factory".
It is worse! It is less!
It is not copying anything than the bare necessary.
Not the necessary in any sort of "reasonable" way,
but necessary in the sense of "enough to run at all".
> Instead of just forking a process (or tasklet in this case)
> and starting to run it, it creates a factory function that saves a copy of a
> process or tasklet. This factory function can return and run the forked
> version of the tasklet over and over. Hopefully this is somewhat close to
> the real definition.
Yes, modulo the consequences of the fact that not any local
or global variable gets saved.
> I was hoping I could simulate this with some simple code, but it looks like
> you can't pickle the current tasklet. [Which is understandable.] Now I'm
> toying with a separate tasklet that does this.
It will (fortunately) not at all be able to mimick this.
If you pickle and restore a tasklet, then you get a clone.
This will very much contain more copies of everything than
sharing stuff.
Consider you have a running loop, and you manage tocapture a full
continuation at some point in the loop body:
If you can clone a tasklet that minicks that, you will
simply have two different tasklets, which can happily
iterate in a duplicated loop.
If you have saved a full continuation of this very loop,
then you instead will have a continuation of this very loop.
And if you activate it, you will operate the *same* loop.
Finally, full continuations are so powerful, that you actually
can build every control structure from them. A language with
continuations does not need any control structure but continuations.
This was another way to get rid of them:
If a construct gets supported that can re-build all the already
existing control flow of the language, then this construct
is too powerful and its support becomes a burden for the language.
Not sure if I make any sense without writing a book -- 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
More information about the Stackless
mailing list