Co-routines?
Levi Pearson
levi at cold.org
Sun Jul 2 22:25:34 MDT 2006
On Jul 2, 2006, at 7:34 AM, Michael Halcrow wrote:
> On Sat, Jul 01, 2006 at 07:58:49PM -0600, Daniel C. wrote:
>> http://en.wikipedia.org/wiki/Coroutines
>
> From the article:
>
> ``As of 2003, many of the most popular programming languages,
> including C and its derivatives, do not have direct support for
> coroutines within the language or their standard libraries. (This is,
> in large part, due to the limitations of stack-based subroutine
> implementation).''
>
> FYI, one of my co-workers is in the process of implementing something
> like this in C.
>
> Mike
You'll also notice in the article an explanation of how you would
implement such a thing in C, and the pitfalls of doing so.
Implementing coroutines in C is a subversion of C's stack semantics,
and as such is a huge hack, and not really standard C. On the other
hand, it's nifty that it's possible to subvert C like that, since it
makes it possible to do interesting things that reach beyond C's
limitations.
Ultimately, though, I think we would be better served by replacing C
and its descendants (C++, Java, etc.) with something more flexible.
Of course, I recognize this isn't a very popular view, but a man can
dream, can't he?
--Levi
More information about the PLUG
mailing list