Continuations and threads (was Re: Iterators & generators)

Aahz Maruch aahz at netcom.com
Thu Feb 17 10:44:20 EST 2000


In article <001601bf7853$6b03e7e0$b7a0143f at tim>,
Tim Peters <tim_one at email.msn.com> wrote:
>
>This gets really involved really fast, and without a precise model
>of computation to build on, discussing relative power is a trap.
>*Generally* speaking, coroutines can be implemented via continuations,
>but not vice versa (continuations are more powerful); but continuations
>and threads can each be implemented via the other (but have vastly
>different pragmatics, which is why Christian worked so hard on
>Stackless); so if threads are more familiar, rephrase your question
>to ask whether having threads can make some things much easier to
>do.  "Of course", and the same for continuations.  Raw threads and
>raw continuations are exceedingly difficult to use correctly, though,
>so Python offers the higher-level threading.py to make thread life
>easier, and continuations in Scheme are usually used "under the
>covers" to implement an easier-to-use abstraction (like coroutines, or
>backtracking search, or ...).

Okay, now I'm starting to get this (be very, very frightened).  Now, can
you (or someone) provide an equally simple explanation of the
differences between continuations and threads?  Given that we already
have threads (sort of), what is the attraction of continuations?  Is it
easier to write continuations than simulate threads on an unthreaded OS?
--
                      --- Aahz (Copyright 2000 by aahz at netcom.com)

Androgynous poly kinky vanilla queer het    <*>     http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6

Our society has become so fractured that the pendulum is swinging
several different directions at the same time



More information about the Python-list mailing list