Abstract
This paper studies the the problem of expressing exceptions using first-class continuations in a functional-imperative language. The main result is that exceptions cannot be macro-expressed using first-class continuations and references (contrary to “folklore”). This is shown using two kinds of counterexample. The first consists of two terms which are equivalent with respect to contexts containing continuations and references, but which can be distinguished using exceptions. It is shown, however, that there are no such terms which do not contain callcc. However, there is a П 1 sentence of first-order logic which is satisfied when interpreted in the domain of programs containing continuations and references but not satisfied in the domain of programs with exceptions and references. This is used to show that even when callcc is omitted from the source language, exceptions still cannot be expressed using continuations and references.
Chapter PDF
Similar content being viewed by others
References
Matthias Felleisen. On the expressive power of programming languages. In Science of Computer Programming, volume 17, pages 35–75, 1991.
Matthias Felleisen, Daniel P. Friedman, Eugene E. Kohlbecker, and Bruce Duba. A syntactic theory of sequential control. Theoretical Computer Science, 52:205–207, 1987.
C. Gunter, D. Rémy, and J. Riecke. A generalization of exceptions and control in ML like languages. In Proceedings of the ACM Conference on Functional Programming and Computer Architecture, pages 12–23, 1995.
J. Laird. Full abstraction for functional languages with control. In Proceedings of the Twelfth International Symposium on Logic In Computer Science, LICS’ 97. IEEE Computer Society Press, 1997.
J. Laird. A fully abstract game semantics of local exceptions. In Proceedings of the Sixteenth International Symposium on Logic In Computer Science, LICS’ 01. IEEE Computer Society Press, 2001.
M. Lillibridge. Unchecked exceptions can be strictly more powerful than Call/CC. Higher-Order and Symbolic Computation, 12(1):75–104, 1999.
J. Mitchell. On abstraction and the expressive power of programming languages. In Proc. Theor. Aspects of Computer Software, pages 290–310, 1991.
C.-H. L. Ong and C. Stewart. A Curry-Howard foundation for functional computation with control. In Proceedings of ACM SIGPLAN-SIGACT syposium on Principles of Programming Languages, Paris, January 1997. ACM press, 1997.
M. Parigot. λμ calculus: an algorithmic interpretation of classical natural deduction. In Proc. International Conference on Logic Programming and Automated Reasoning, pages 190–201. Springer, 1992.
J. Reynolds. Theories of Programming Languages. Cambridge University Press, 1998.
Jon G. Riecke. The Logic and Expressibility of Simply-Typed Call-by-Value and Lazy Languages. PhD thesis, Massachusetts Institute of Technology, 1991. Available as technical report MIT/LCS/TR-523 (MIT Laboratory for Computer Science).
J. Riecke and H. Thielecke. Typed exceptions and continuations cannot macroexpress each other. In J. Wiedermann, P. van Emde Boas and M. Nielsen, editor, Proceedings of ICALP’ 99, volume 1644 of LNCS, pages 635–644. Springer, 1999.
A. Sabry and M. Felleisen. Reasoning about programs in continuation-passing style. LISP and Symbolic Computation, 6(3/4):289–360, 1993.
H. Thielecke. On exceptions versus continuations in the presence of state. In Proceedings of ESOP 2000, volume 1782 of LNCS. Springer, 2000.
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2002 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Laird, J. (2002). Exceptions, Continuations and Macro-expressiveness. In: Le Métayer, D. (eds) Programming Languages and Systems. ESOP 2002. Lecture Notes in Computer Science, vol 2305. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-45927-8_10
Download citation
DOI: https://doi.org/10.1007/3-540-45927-8_10
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-43363-7
Online ISBN: 978-3-540-45927-9
eBook Packages: Springer Book Archive