skip to main content
article

Functional pearl: the great escape or, how to jump the border without getting caught

Published: 01 October 2007 Publication History

Abstract

Filinski showed that callcc and a single mutable reference cell are sufficient to express the delimited control operators shift and reset. However, this implementation interacts poorly with dynamic bindings like exception handlers. We present a variation on Filinski's encoding of delimited continuations that behaves appropriately in the presence of exceptions and give an implementation in Standard ML of New Jersey. We prove the encoding correct with respect to the semantics of delimited dynamic binding.

References

[1]
Dariusz Biernacki, Olivier Danvy, and Chung-chieh Shan. On the static and dynamic extents of delimited continuations. Science of Computer Programming, 60(3):274--297, 2006. ISSN 0167-6423.
[2]
Olivier Danvy and Andrzej Filinski. A functional abstraction of typed contexts. Technical Report 89/12, DIKU, University of Copenhagen, 1989.
[3]
Matthias Felleisen. The calculi of λ v -CS conversion: A syntactic theory of control and state in imperative higher-order languages. PhD thesis, 1987.
[4]
Matthias Felleisen. The theory and practice of first-class prompts. In Symposium on Principles of Programming Languages, 1988.
[5]
Andrzej Filinski. Controlling Effects. PhD thesis, School of Computer Science, Carnegie Mellon University, May 1996. Available as Technical Report CMU-CS-96-119.
[6]
Chris Hanson. MIT scheme reference manual. Technical Report AITR-1281, 1991.
[7]
Christopher T. Haynes and Daniel P. Friedman. Embedding continuations in procedural objects. ACM Transactions on Programming Languages and Systems (TOPLAS), 9(4):582--598, 1987. ISSN 0164-0925.
[8]
Richard Kelsey, William Clinger, and Jonathan Rees (Editors). Revised5 report on the algorithmic language Scheme. ACM SIGPLAN Notices, 1998.
[9]
Oleg Kiselyov. How to remove a dynamic prompt: static and dynamic delimited continuation operators are equally expressible. Technical Report 611, Indiana University, March 2005.
[10]
Oleg Kiselyov, Chung-chieh Shan, and Amr Sabry. Delimited dynamic binding. In International Conference on Functional Programming, 2006.
[11]
Jeffrey R. Lewis, Mark Shields, John Launchbury, and Erik Meijer. Implicit parameters: Dynamic scoping with static types. In Symposium on Principles of Programming Languages, 2000.
[12]
Robin Milner, Mads Tofte, and Robert Harper. The definition of Standard ML. MIT Press, Cambridge, MA, 1990. ISBN 0-262-63132-6.
[13]
Luc Moreau. A Syntactic Theory of Dynamic Binding. In International Joint Conference on Theory and Practice of Software Development (TAPSOFT/FASE'97), volume 1214, pages 727--741, Lille, France, April 1997. Springer-Verlag.
[14]
John C. Reynolds. Definitional interpreters for higher-order programming languages. In ACM Annual Conference, pages 717--740, August 1972.
[15]
Chung-Chieh Shan. Shift to control. In Scheme Workshop, September 2004.
[16]
Dorai Sitaram. Models of Control and Their Implications for Programming Language Design. PhD thesis, 1994.
[17]
Dorai Sitaram and Matthias Felleisen. Control delimiters and their hierarchies. Lisp and Symbolic Computing, 3(1), 1990.
[18]
Hayo Thielecke. Comparing control constructs by double-barrelled CPS. Higher-Order and Symbolic Computation, 14(2):141--160, 2002.
[19]
Mitchell Wand and Daniel P. Friedman. The mystery of the tower revealed: a non-reflective description of the reflective tower. In LISP and functional programming, 1986.

Index Terms

  1. Functional pearl: the great escape or, how to jump the border without getting caught

    Recommendations

    Comments

    Information & Contributors

    Information

    Published In

    cover image ACM SIGPLAN Notices
    ACM SIGPLAN Notices  Volume 42, Issue 9
    Proceedings of the ICFP '07 conference
    September 2007
    331 pages
    ISSN:0362-1340
    EISSN:1558-1160
    DOI:10.1145/1291220
    Issue’s Table of Contents
    • cover image ACM Conferences
      ICFP '07: Proceedings of the 12th ACM SIGPLAN international conference on Functional programming
      October 2007
      346 pages
      ISBN:9781595938152
      DOI:10.1145/1291151
    Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

    Publisher

    Association for Computing Machinery

    New York, NY, United States

    Publication History

    Published: 01 October 2007
    Published in SIGPLAN Volume 42, Issue 9

    Check for updates

    Author Tags

    1. continuations
    2. delimited control
    3. dynamic binding

    Qualifiers

    • Article

    Contributors

    Other Metrics

    Bibliometrics & Citations

    Bibliometrics

    Article Metrics

    • Downloads (Last 12 months)5
    • Downloads (Last 6 weeks)0
    Reflects downloads up to 20 Jan 2025

    Other Metrics

    Citations

    View Options

    Login options

    View options

    PDF

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader

    Media

    Figures

    Other

    Tables

    Share

    Share

    Share this Publication link

    Share on social media