开发者

Are there any programming languages where continuations restore the heap in addition to the stack?

Languages that I am familiar with with support for continuations (Scheme and Ruby) restore the stack state and instruction pointer from when the continuation was created. I am wondering if there are any programming languages where invoking the continuation restores the heap as well?

[EDIT:] In addition to Marcelo's answer that I accept开发者_StackOverflowed I also found an extension to ML that supported the concept of "stores" which are effectively what I describe. See the paper Refining First Class Stores by Greg Morrisett.


Since all objects are immutable in Haskell, I think it's safe to say that a continuation would restore the entire state of the process, including the heap.

It would be interesting to figure out how that affects I/O and other monadic behaviours. I'll hazard a wild guess that the type system won't allow a return back to the state before an I/O event occurred. (A continuation is itself a monad, so you probably can't interleaved it with I/O.)

Caveat: I barely know Haskell, so the above comments could be a laughable pile of nonsense.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜