On Oct 4, 2006, at 1:25 AM, Norman Palardy wrote:
The feature that Stackless Python implements is the coroutine.
Coroutines are quite easy to do in C
setjmp / longjmp are pretty much built for this
Well, theoretically, yes, and practically, meh, it's problematic.
From the Wikipedia article on coroutines:
Implementations for C
The standard C library includes functions named setjmp and longjmp
which can be used to implement a form of coroutine. Unfortunately, as
Harbison and Steele note, "the setjmp and longjmp functions are
notoriously difficult to implement, and the programmer would do well
to make minimal assumptions about them."[3] What this means is if
Harbison and Steele's many cautions and caveats are not carefully
heeded, uses of setjmp and longjmp that appear to work in one
environment may not work in another. Worse yet, faulty
implementations of these routines are not rare. The setcontext family
of functions are considerably more powerful than setjmp/longjmp, but
conforming implementations are as rare if not rarer.
My point about C was that if I have my history correct, it was the
rapid and thoroughgoing adoption of C as the world's programming
language that saw the world adopt imperative, structured and stack-
calling as the basis of all popular languages. Sure, you *could* do
object-oriented programming in C (Objective C was first implemented
as a set of C macros, I believe), and you can do coroutines in C. But
who does?
And this doesn't detract from: you can't do coroutines in REALbasic
right now, and it would be nice if we could.
OTOH, adding features to the threading in REALbasic would only
complicate moving to OS threads, which as everyone is aware, is now a
Really Good Idea(TM).
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>