eiffel, threads, coroutines, generators, continuation passing
Marcio Marchini <[email protected]> Fri, 19 Aug 2005 12:36:31 -0400
| Newsgroups | gmane.comp.lang.eiffel.smalleiffel |
|---|---|
| Message-ID | <[email protected]> |
Now that there seems to be an Eiffel fork anyway, I want to bang on
something I have asked before. Ever since trying to make a client and
server rsync program in SmallEiffel (at the time, it was Small, not
Smart) and having to resort to multiplexers and state machines etc
because of blocking calls on sockets etc and no thread support, I have
requested a few times some higher abstraction for that sort of stuff. I
mentioned things like coroutines, Python generators
(http://www.python.org/doc/current/ref/yield.html) , also to appear in
C# etc.
Well, the world keeps moving and Stackless Python
http:/www.stackless.com has implemented micro Threads etc by using
continuation passing (See "Lambda: The Ultimate Imperative"
http://library.readscheme.org/page1.html
In fact, they do it (used to, at least) with binary compatibility:
http://gnosis.cx/publish/programming/charming_python_8.txt
[Mertz]: The goal of Stackless is to be 100% binary
compatible with CPython. Is it?
[Tismer]: Stackless is 100% binary compatible at the moment.
That means: You install Python 1.5.2, you replace
python15.dll with mine, and everything still works, including
every extension module. It is not a goal, it was a demand,
since I didn't want to take care about all the extensions.
So, is there any hope of seeing this kind of stuff in SmartEiffel ?
I like this part:
[Tismer]: Continuations are hard to sell. Coroutines and
generators, and especially microthreads are easier. All of
the above -can- be implemented without having explicit
continuations. But when you have continuations already, you
find that the step to these other structures is quite small,
and continuations are the way to go. So I'm going to change
my marketing strategy and not try any longer to sell the
continuations, but their outcome. Continuations will still
be there for those who can see the light.
And for those who doubt the power of this model:
http://www2.eve-online.com/faq/faq_07.asp
"EVE uses a special Stackless version of Python for both the server and
the client. This makes for a much simpler creation of game logic than
what was available in the past. The control structures provided by
Stackless allow for a more “procedural syncronous” model, rather than an
“event driven asynchronous,” or thread pooling.
In more simplified terms, this means that a large number of actors can
perform tiny tasks without the added complexity or overhead of the other
two execution models. Our game logic scripters are thereby freed from
many of the mundane tasks associated with models that don’t benefit from
the control structures provided by Stackless. The creative process of
writing interesting game behavior is no longer bogged down by software
or system limitations.
This approach also means that making changes to the game is much easier
than it has been historically. Many improvements or tweaks can be added
even when the world is online and going strong without the need to
reboot the servers. This process is called a hot fix.
Please help us support Stackless Python and the excellent contribution
it is making to online gaming. "
Thanks,
marcio