Dustin Laurence <[EMAIL PROTECTED]> writes: > I'm pretty sure this is stepping into deep quicksand, but I'll ask > anyway...I'm interested in writing an FE for a language that has > stackable coroutines (Lua-style, where you can yield and resume > arbitrarily far down the call stack). I'm trying to wrap my head around > what would be involve and how awful it would be. > > There are a few "coroutines in C" packages packages laying around, but > they don't seem to be stackable (I'm sure the ones based on Duff's > device aren't). Since you can't switch call stacks from C I think what > I want is impossible at that level.
You might want to look at the SUS functions getcontext/setcontext/makecontext/swapcontext. They allow you to switch call stacks in C, although maybe not quite in the way you were hoping. However, they're obsolescent; SUS suggests using threads instead.