Implementing Continuation Marks in Javascript
Article comments
9 pages.
© ACM, 2008. 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 2008 Workshop on Scheme and Functional Programming and is available at http://www.schemeworkshop.org/2008/program.html.
Abstract
MzScheme’s continuation marks provide a flexible mechanism for implementing a number of useful language features and tools. We demonstrate the simplicity and utility of continuation marks by adapting them for JavaScript as frame-based stack marks using the Rhino implementation, showing a simple model of their behavior, and using them to build a toy debugger.
Along the way, we discover a few interesting things. First, it requires some thinking—but not much code—to add continuation marks to JavaScript. Second, coupling tail-calling with the “return” of statement-based languages leads to some interesting problems in formulating a semantics. Third, building a debugger based on continuation marks highlights (by its absence) the elegance of Scheme’s simple syntax and hygienic macro system.
Suggested Citation
John Clements, Ayswarya Sundaram, and David Herman. "Implementing Continuation Marks in Javascript" Proceedings of the 2008 Workshop on Scheme and Functional Programming.. Sep. 2008.
Available at: http://works.bepress.com/jclement/4