Re: Coroutines: not structured programming

Top Page

Reply to this message
Author: Bob Ippolito
Date:  
To: True Computer Science Mailing List, andy
CC: 
Subject: Re: Coroutines: not structured programming

On Mar 20, 2004, at 12:19 AM, Andy Sy wrote:

> dido@??? wrote:
>
>> Liskov at MIT, and well, CLU iterators were shamelessly stolen by one
>> of
>> my favorite languages, Ruby. :)
>
> Apparently, Ruby also has continuations and according to what I've
> been reading, continuations can be the building block for all other
> flow control constructs - including coroutines and generators.
>
> Christian Tismer originally used continuations to deliver the
> functionality of Stackless Python, but he has since abandoned
> this approach in favor of tasklets/greenlets. These sound akin
> to threads but, according to Tismer, have a 'superior interface'


In practice, hardly anyone uses continuations directly anyhow. The
higher level constructs in recent versions of Stackless are good enough
for anything except defining new flow control structures, which isn't
even useful/practical in Python. tasklets/greenlets are also MUCH
cheaper to implement, as they are much closer to how the rest of the
implementation of Python works and don't require lots of copying in
order to make sense, because you can only really start a new one at the
top of a function. Though if you really wanted a continuation you
could emulate one by abusing the fact that tasklets/greenlets are
pickleable, so you could __reduce__ one that's running and instantiate
a copy.

> They are also supposed to be much less resource intensive (on
> the order of millions of tasklets running on your average desktop
> machine - making it far more scalable than even NPTL and NGPL).
>
> Tismer's decision is clearly a major shift in Stackless' direction.
> I believe this has been influenced by his exchanges with Python's
> benevolent dictator, who tends to be very pragmatic when it comes
> to adding exotic features. (In fact, if one reads
> http://www.python.org/doc/essays/ppt/regrets/PythonRegrets.pdf
> Guido is probably inclined to _remove_ some features in Python
> 3.0... yay!)


That's only one of the many reasons, and probably a minor one at that.

-bob

______________________________________________________
True Computer Science Mailing List
compsci@??? (#CompSci @ irc.free.net.ph)
http://lists.free.net.ph/mailman/listinfo/compsci
Searchable Archives: http://marc.free.net.ph