Stackless/microthreads merge news

Christian Tismer tismer at tismer.com
Tue May 9 14:18:46 EDT 2000


Brent Fulgham wrote:
> 
> >
> > Glyph Lefkowitz wrote:
> > ...
> > > Also; the hype that's used here is all about the "enterprise"
> > > (whatever that is) and how Java is basically the new COBOL.
> > > Continuations are a LISPish feature, and won't be
> > > appreciated, as far as I can tell, by the ex-COBOL community
> > > now coming into Java.
> >
> > This argument has hit me right between the eyes.
> > I may be changing targets again, not so sure,
> > but see Jeff Senn's post and my reply.
> > Rebuilding Python as a very tiny, scalable engine
> > for microcontrollers could be what we need, soon.
> >
> Christian,
> 
> Don't cut off your nose to spite your face!
> 
> I'm sure the Kaffe people would fall over themselves with
> glee to get your stackless code into Kaffe.  It would provide
> both a performance benefit and the ability to include new
> features.
> 
> Let the COBOLers complain -- LISP is here to stay! :-)

I've been looking quite closely at their code.
This is quite a task. Stuff is well written,
but it is much if you are not used to it.
I know Python's source quite by heart, this
makes much of a difference.
Anyway, what I can say is that they already
have some decoupling of stacks. The C code uses
a technique called "trampoline" in some cases,
which is quite similar to what I do.

While it seems to be possible to make it stackless
(since it is, partly already) with some more
consideration how to handle Java's stack view
correctly, there are other problems:

I won't put any effort into this until I know
that Java can stand continuations. That's the point.

I'm no Java expert, but AFAIK Java is very strict
about passing arguments and return values, and
the biggest problem might be exceptions. Java
is explicit about what exceptions can be thrown where,
and not declaring the right "throws" list is a syntax
error. If I now introduce continuations and try to
stick them together in another way, I get into a hard
compatibility problem. Without massive work on the
compiler, I doubt I could modify the caller chain
as easily as with Python. This is a very powerful
feature in Stackless Python.
The only thing that could be done is to capture
continuations, store them in variables and call them
later. This still gives the stack sharing problems
which were quite hard to solve for Python.

I'm not sure if people are really looking for this power,
or if they just want to build coroutines. Since there
are green threads in some implementations, it is the
question if one should put so much effort into it, or
just implement coroutines with green threads.

Besides some nifty examples from Python experts, I've
never seen anybody to make real use of continuations
covering their real power.

the-payoff-for-Python-was-bigger-so-lets-consider-carefully-ly 
   y'rs - chris

-- 
Christian Tismer             :^)   <mailto:tismer at appliedbiometrics.com>
Applied Biometrics GmbH      :     Have a break! Take a ride on Python's
Kaunstr. 26                  :    *Starship* http://starship.python.net
14163 Berlin                 :     PGP key -> http://wwwkeys.pgp.net
PGP Fingerprint       E182 71C7 1A9D 66E9 9D15  D3CC D4D7 93E2 1FAE F6DF
     where do you want to jump today?   http://www.stackless.com




More information about the Python-list mailing list