[Stackless] micro-threads & co-routines

Dirk-Ulrich Heise hei at adtranzsig.de
Sun Oct 15 14:26:55 CEST 2000

-----Ursprüngliche Nachricht-----
Von: "Christian Tismer" <tismer at appliedbiometrics.com>
> > > >A completely different question: All these concepts by
> > > >Christian seem to be very complex. Did somebody
> > > >consider modeling them using Python, that is, create a sort of
> > > >prototype engine that would allow testing them before the C
> > > >coding starts? Just asking for curiosity.
> According to Gordon's comment below: This would be simple,
> after rewriting the whole Python interpreter in Python (and
> the latter is not so simple:)

I thought of a stripped-down prototype - an interpreter
that would be designed to "work like the CPython interpreter",
without actually being a full Python implementation. I'm just
playing  with a tiny FORTH engine i wrote in Python, and that
one needs an interpreter loop, as well. Still so rudimentary
that it actually doesn't have a return stack at the moment.
I will make the stacks explicit, so the Forth engine will be
stackless by design. Maybe, when i try to give it continuations
(given i will understand what they are), i'll run into the same
ownership problems like you.

My weird stack manipulation experiments by now happened
in an editor macro language, where i mainly use it to "pickle"
the state of the program execution, something of this will
also flow into the Forth engine. An interpreter state is
pickled when the program calls a function called "PROBLEM()".
The programmer could now modify the caller of PROBLEM()
to get around this problem, using other, new interpreters.
These can of course call PROBLEM() themselves, and
you might end up with a lot of pickled states that are so
interwoven that any try to return to a modified program
gets so complicated your necortex starts melting.
And the machine gets confused over it, too, very funny.

I think we germans seek such problems because we
have read too much Nietzsche or so.

"He who fights with monsters should look to it that he himself
does not become a monster...When you gaze long into the abyss,
the abyss also gazes into you..." - Friedrich Nietzsche

Just another way up the mountain, like a runners high or taking
too many drugs. It's all about Endorphin.

Dipl.Inform. Dirk-Ulrich Heise
hei at adtranzsig.de
dheise at debitel.net

Stackless mailing list
Stackless at starship.python.net

More information about the Stackless mailing list