Exception handlers as extensible cases

12Citations
Citations of this article
10Readers
Mendeley users who have this article in their library.
Get full text

Abstract

Exceptions are an indispensable part of modern programming languages. They are, however, handled poorly, especially by higherorder languages such as Standard ML and Haskell: in both languages a well-typed program can unexpectedly fail due to an uncaught exception. In this paper, we propose a technique for type-safe exception handling. Our approach relies on representing exceptions as sums and assigning exception handlers polymorphic, extensible row types. Based on this representation, we describe an implicitly typed external language EL where well-typed programs do not raise any unhandled exceptions. EL relies on sums, extensible records, and polymorphism to represent exceptionhandling, and its type system is no more complicated than that for existing languages with polymorphic extensible records. EL is translated into an internal language IL that is a variant of System F extended with extensible records. The translation performs a CPS transformation to represent exception handlers as continuations. It also relies on duality to transform sums into records. (The details for this translation are given in an accompanying technical report.) We describe the implementation of a compiler for a concrete language based on EL. The compiler performs full type inference and translates EL-style source code to machine code. Type inference relieves the programmer from having to provide explicit exception annotations. We believe that this is the first practical proposal for integrating exceptions into the type system of a higher-order language. © 2008 Springer Berlin Heidelberg.

Cite

CITATION STYLE

APA

Blume, M., Acar, U. A., & Chae, W. (2008). Exception handlers as extensible cases. In Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics) (Vol. 5356 LNCS, pp. 273–289). Springer Verlag. https://doi.org/10.1007/978-3-540-89330-1_20

Register to see more suggestions

Mendeley helps you to discover research relevant for your work.

Already have an account?

Save time finding and organizing research with Mendeley

Sign up for free