skip to main content
article

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

Published:01 October 2007Publication History
Skip Abstract Section

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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Olivier Danvy and Andrzej Filinski. A functional abstraction of typed contexts. Technical Report 89/12, DIKU, University of Copenhagen, 1989.Google ScholarGoogle Scholar
  3. Matthias Felleisen. The calculi of λv-CS conversion: A syntactic theory of control and state in imperative higher-order languages. PhD thesis, 1987. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Matthias Felleisen. The theory and practice of first-class prompts. In Symposium on Principles of Programming Languages, 1988. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Andrzej Filinski. Controlling Effects. PhD thesis, School of Computer Science, Carnegie Mellon University, May 1996. Available as Technical Report CMU-CS-96-119.Google ScholarGoogle Scholar
  6. Chris Hanson. MIT scheme reference manual. Technical Report AITR-1281, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Richard Kelsey, William Clinger, and Jonathan Rees (Editors). Revised5 report on the algorithmic language Scheme. ACM SIGPLAN Notices, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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.Google ScholarGoogle Scholar
  10. Oleg Kiselyov, Chung-chieh Shan, and Amr Sabry. Delimited dynamic binding. In International Conference on Functional Programming, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Robin Milner, Mads Tofte, and Robert Harper. The definition of Standard ML. MIT Press, Cambridge, MA, 1990. ISBN 0-262-63132-6. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. John C. Reynolds. Definitional interpreters for higher-order programming languages. In ACM Annual Conference, pages 717--740, August 1972. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Chung-Chieh Shan. Shift to control. In Scheme Workshop, September 2004.Google ScholarGoogle Scholar
  16. Dorai Sitaram. Models of Control and Their Implications for Programming Language Design. PhD thesis, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Dorai Sitaram and Matthias Felleisen. Control delimiters and their hierarchies. Lisp and Symbolic Computing, 3(1), 1990. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Hayo Thielecke. Comparing control constructs by double-barrelled CPS. Higher-Order and Symbolic Computation, 14(2):141--160, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

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

    Recommendations

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in

    Full Access

    • 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

      Copyright © 2007 ACM

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 1 October 2007

      Check for updates

      Qualifiers

      • article

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader
    About Cookies On This Site

    We use cookies to ensure that we give you the best experience on our website.

    Learn more

    Got it!