Postprint version. Published in Proceedings of the 10th ACM SIGPLAN International Conference on Functional Programming, September 26, 2005, pages 216-227.
NOTE: At the time of publication, the author John Clements was not yet affiliated with Cal Poly.
The definitive version is available at https://doi.org/10.1145/1086365.1086393.
Implementing first-class continuations can pose a challenge if the target machine makes no provisions for accessing and re-installing the run-time stack. In this paper, we present a novel translation that overcomes this problem. In the first half of the paper, we introduce a theoretical model that shows how to eliminate the capture and the use of first-class continuations in the presence of a generalized stack inspection mechanism. The second half of the paper explains how to translate this model into practice in two different contexts. First, we reformulate the servlet interaction language in the PLT Web server, which heavily relies on first-class continuations. Using our technique, servlet programs can be run directly under the control of non-cooperative web servers such as Apache. Second, we show how to use our new technique to copy and reconstitute the stack on MSIL. Net using exception handlers. This establishes that Scheme’s first-class continuations can exist on non-cooperative virtual machines
This is the author's version of the work. It is posted here by permission of ACM for your personal use. Not for redistribution. The definitive version was published in Proceedings of the 10th ACM SIGPLAN International Conference on Functional Programming.