Nitpick: the beautiful thing about Smalltalk's continuation support is that it's not provided by the compiler. (As far as I know, Squeak still doesn't ship with continuation support built-in.)
Despite this, because stack frames are first class objects in Smalltalk, it's very easy for the user to implement continuations. You just traverse the stack to capture the continuation, and switch stack frames with the continuation's in order to invoke it. The resulting Continuation class is almost improbably literal in its implementation.
Thanks, good point. I actually meant to reference scheme, not smalltalk - as I believe that's where continuations were first done. I believe it is provided by the runtime in scheme (but still, not the compiler). I've corrected the post now.
Comments
Nitpick: the beautiful thing about Smalltalk's continuation support is that it's not provided by the compiler. (As far as I know, Squeak still doesn't ship with continuation support built-in.)
Despite this, because stack frames are first class objects in Smalltalk, it's very easy for the user to implement continuations. You just traverse the stack to capture the continuation, and switch stack frames with the continuation's in order to invoke it. The resulting Continuation class is almost improbably literal in its implementation.
This is what frameworks like Seaside do.
Thanks, good point. I actually meant to reference scheme, not smalltalk - as I believe that's where continuations were first done. I believe it is provided by the runtime in scheme (but still, not the compiler). I've corrected the post now.