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.
Oh, absolutely. I’m reasonably aware of the problems involved, which
is why I don’t think it’s worthwhile. C’s a lousy target for this
sort of thing. Not that the native machine language is generally much
better as a target as most chips these days had C in mind for their
design, but at least you throw away any pretense that the language’s
going to give you any help.
But why bother?
Speed, mainly. Going from an interpreted to a compiled form gives a
number of opportunities to remove overhead. Walking optrees has some
expense involved–depending on how complex the operation is, how much
optimization you do, and the CPU architecture, you can see a speedup
somewhere between 1.1 and 40 times going compiled.
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!
Right, but Ruby’s interpreted right now. Compilation brings a number
of benefits, though there are potentially some tradeoffs involved as
At 6:49 PM -0400 7/20/02, Brad Cox wrote:
At 7:20 AM +0900 7/21/02, Dan Sugalski wrote:
--------------------------------------“it’s like this”-------------------
Dan Sugalski even samurai
firstname.lastname@example.org have teddy bears and even
teddy bears get drunk