At 7:20 AM +0900 7/21/02, Dan Sugalski wrote:
>Continuations are a massive pain to do in a language that doesn't 
>have them. Doing continuations means messing around with the system 
>stack, and to do it well you really want to treat the stack as a 
>tree of semi-independent frames rather than a single chunk of 
>contiguous memory as most C-style languages do.

I spent years on this problem in the middle 80's (search for 
TaskMaster on my website). I mainly proved that is possible to add 
continuations, exceptions, garbage collection, what have you, to C, 
but its almost impossible to do any of these things well, certainly 
without sacrificing the things C is good at.

But why bother? Ruby's not C and it has continuations already. 
There's absolutely no need to plow that furrow again. Spend the time 
on something useful!

>There are tricks you can play, for example you can translate all 
>function calls into a continuation-passing style call and do Evil 
>Things with setjmp/longjmp, but generally those tricks are, well, 
>evil. Plus they don't Play Well with others. (Though, arguably, 
>anytime you mix languages with continuations with languages without 
>continuations you can run into trouble, but it's not tough to make 
>those bad spots edge cases)

-- 
Brad Cox, PhD; bcox / virtualschool.edu 703 361 4751
o For industrial age goods there were checks and credit cards.
    For everything else there is http://virtualschool.edu/mybank
o Interactive Learning Environment http://virtualschool.edu/ile
o Java Web Application Architecture: http://virtualschool.edu/jwaa