gwtmp01 / mac.com wrote: > > On Jan 30, 2007, at 10:38 AM, John Lam (CLR) wrote: >> On the CLR front (and I'm pretty sure on the JVM front as well) >> continuations pose a very major problem for implementers. It's a >> difficult problem to solve while preserving decent performance >> characteristics. And the approaches that have been attempted in the >> past (like exploiting the exception facilities of the runtime) don't >> hold forth the promise of future performance improvements. > > Do you have any pointers to resources (papers, blog entries, source > code) that elaborate on the difficulties of implementing continuations? > Is it difficult in the theoretical sense or simply difficult to > implement on top of VMs that were designed without continuations in mind? The latter. The JVM and CLR do not provide any way to manipulate the call stack, which is the typical and probably most efficient way to implement continuations (aside from providing your own machine and call stack implementation, which would essentially be an interpreter-on-VM in both cases). So yes, they're difficult to do on the JVM and CLR. Maybe impossible without severe performance degradation, and entirely impossible to do when third-party libraries are involved that don't play nice with even the cleverest tricks we could come up with. For this reason, it's highly likely that even if continuations did survive into later 1.9 and 2.0 releases, they may never be available on the CLR or JVM. Ruby developers will have to decide if inability to run on JVM or CLR-based Ruby implementations is worth all the continuation-based "funky stuff". Honestly, I don't think it is. - Charlie