Affiliation:
1. Cornell University, USA
2. TU Darmstadt, Germany
3. Massachusetts Institute of Technology, USA
Abstract
Unhandled exceptions crash programs, so a compile-time check that exceptions are handled should in principle make software more reliable. But designers of some recent languages have argued that the benefits of statically checked exceptions are not worth the costs. We introduce a new statically checked exception mechanism that addresses the problems with existing checked-exception mechanisms. In particular, it interacts well with higher-order functions and other design patterns. The key insight is that whether an exception should be treated as a "checked" exception is not a property of its type but rather of the context in which the exception propagates. Statically checked exceptions can "tunnel" through code that is oblivious to their presence, but the type system nevertheless checks that these exceptions are handled. Further, exceptions can be tunneled without being accidentally caught, by expanding the space of exception identifiers to identify the exception-handling context. The resulting mechanism is expressive and syntactically light, and can be implemented efficiently. We demonstrate the expressiveness of the mechanism using significant codebases and evaluate its performance. We have implemented this new exception mechanism as part of the new Genus programming language, but the mechanism could equally well be applied to other programming languages.
Funder
U.S. Air Force
European Research Council
National Science Foundation
Publisher
Association for Computing Machinery (ACM)
Subject
Computer Graphics and Computer-Aided Design,Software
Reference52 articles.
1. Ada 95. Ada 95 reference manual: language and standard libraries 1997. Ada 95. Ada 95 reference manual: language and standard libraries 1997.
2. Apache Commons. The Apache Commons project. https: //commons.apache.org/. Apache Commons. The Apache Commons project. https: //commons.apache.org/.
3. The DaCapo benchmarks
4. Exception analysis and points-to analysis
Cited by
5 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献