5 ms·
How does this differ from scheme-style continuations? IIRC, full continuations in the scheme sense of the term are currently impossible in Java as they require
by SeanLuke 7y ago
How does this differ from scheme-style continuations? IIRC, full continuations in the scheme sense of the term are currently impossible in Java as they require forbidden stack manipulation. Or is what's being proposed here something entirely else?
- deleted 7y ago[deleted]
- chrisseaton 7y ago> currently impossible in Java as they require forbidden stack manipulation They're changing the JVM and Java specs, so what is forbidden or not will change.
- aardvark179 7y agoWe're adding delimited one-shot continuations to the JVM. The common public interface to these is likely to be fibers rather than raw continuations, as they are much easier to work with and allow the standard library and lots of existing code to take advantage of the new features with little to no change.
- maxiepoo 7y agoBy one-shot you mean dynamically enforced, right? I.e. if you invoke it a second time it will raise an exception?
- ufo 7y agoNot exactly, since they are using a fiber API instead of one built with raw continuations. In this context, being one-shot means that there is no operation for cloning or "forking" a fiber. Each time you resume the execution of a fiber, it continues to execute until it reaches its next yield point. There is no way to go "back in time" and resume execution from a previous state of the fiber, which is what multishot coroutines or the fork system call would let you do.
- bjoli 7y agoYou almost never want full continuation. They are less efficient, harder to reason about (because they capture things outside the call/cc) and are a generally fantastic way to accidentally leak memory. Oleg Kiselyov has written about it extensively: http://okmij.org/ftp/continuations/ http://okmij.org/ftp/continuations/