2013-12-25

#stackless #python dis- #continuations

11.20: news.adda/stackless python/dis-continuations:
Christian Tismer 2000:
. this paper presents an implementation
of "Stackless Python" (a Python which
does not keep state on the C stack) .
By decoupling the frame stack from the C stack,
we now have the ability to keep references to frames
and to do non-local jumps.
This turns the frame stack into a tree,
and every leaf of the tree can now be a jump target.
While exploring this idea,
we will recognize ordinary function calls and returns
to be just special cases of so-called continuations, ... .
why should stackless be popular?
. the maximum recursion level would be a user option
and not a limit set by C's stack .
There would be pickleable execution states;
that means you can save your running program
and send it in a file to another computer
where it can continue running .
where is stackless now?:
Tismer, the author of stackless,
is now deeply involved with PyPy
-- " the way of the future".
He has implemented Stackless in PyPy
and considers it superior to Stackless itself .
why isn't stackless popular?:
. it's not clear to me why it has to be
defined in terms of continuations;
concurrency and pickling are really simple concepts,
and while continuations may be
an exciting academic challenge,
they are hardly essential to stacklessness,
and they really worsen the design problem's complexity .

20: adda/cstr/goto gone wild (related to continuations):
Tismer 2000:
"By decoupling the frame stack from the C stack,
we now have the ability to keep references to frames
and to do non-local jumps.
This turns the frame stack into a tree,
and every leaf of the tree can now be a jump target. " 
-- when I read that, I had this idea about
being able to call a control subprogram
that would decide where the next goto would be to;
eg, the typical function after finishing
passes control to where the caller made the call,
but a ( goto subprogram() ) call
could also go to any other place
in any currently active act'rec .