skip to main content
article
Public Access

Accepting blame for safe tunneled exceptions

Published:02 June 2016Publication History
Skip Abstract Section

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.

References

  1. Ada 95. Ada 95 reference manual: language and standard libraries, 1997.Google ScholarGoogle Scholar
  2. Apache Commons. The Apache Commons project. https: //commons.apache.org/.Google ScholarGoogle Scholar
  3. A. P. Black. Exception handling: The case against. PhD thesis, University of Oxford, 1982.Google ScholarGoogle Scholar
  4. S. M. Blackburn, R. Garner, C. Hoffmann, A. M. Khang, K. S. McKinley, R. Bentzur, A. Diwan, D. Feinberg, D. Frampton, S. Z. Guyer, M. Hirzel, A. Hosking, M. Jump, H. Lee, J. E. B. Moss, A. Phansalkar, D. Stefanovi´c, T. VanDrunen, D. von Dincklage, and B. Wiedermann. The DaCapo benchmarks: Java benchmarking development and analysis. In 21st ACM SIGPLAN Conf. on Object-Oriented Programming, Systems, Languages and Applications (OOPSLA), pages 169–190, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. M. Bravenboer and Y. Smaragdakis. Exception analysis and points-to analysis: Better together. In Proceedings of the Eighteenth International Symposium on Software Testing and Analysis, ISSTA ’09, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. P. A. Buhr and W. Y. R. Mok. Advanced exception handling mechanisms. IEEE Trans. Softw. Eng., 26(9), Sept. 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. B. Cabral and P. Marques. Exception handling: A field study in Java and .NET. In 21st European Conf. on Object-Oriented Programming, pages 151–175, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. B. Cabral and P. Marques. Hidden truth behind .NET’s exception handling today. IET Software, 1(6), 2007.Google ScholarGoogle Scholar
  9. B. Cahoon and K. S. McKinley. Data flow analysis for software prefetching linked data structures in Java. In International Conference on Parallel Architectures and Compilation Techniques (PACT), Sept. 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. CWE. Common weakness enumeration list. http://cwe. mitre.org/data/.Google ScholarGoogle Scholar
  11. B. Eckel. Does Java need checked exceptions? http://www. mindview.net/Etc/Discussions/CheckedExceptions, 2003.Google ScholarGoogle Scholar
  12. M. Fähndrich, J. S. Foster, A. Aiken, and J. Cu. Tracking down exceptions in standard ML programs. Technical report, EECS Department, UC Berkeley, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. FindBugs bug descriptions. Findbugs bug descriptions. http: //findbugs.sourceforge.net/bugDescriptions.html/.Google ScholarGoogle Scholar
  14. R. B. Findler and M. Felleisen. Contracts for higher-order functions. In 7th ACM SIGPLAN Int’l Conf. on Functional Programming, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. R. B. Findler, M. Latendresse, and M. Felleisen. Behavioral contracts and behavioral subtyping. In ESEC/FSE-9, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. A. F. Garcia, C. M. Rubira, A. Romanovsky, and J. Xu. A comparative study of exception handling mechanisms for building dependable object-oriented software. Journal of Systems and Software, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. B. Goetz. Java theory and practice: The exceptions debate. http://www.ibm.com/developerworks/library/ j-jtp05254, 2004.Google ScholarGoogle Scholar
  18. B. Goetz. Exception transparency in Java. http: //blogs.oracle.com/briangoetz/entry/exception_ transparency_in_java, 2010.Google ScholarGoogle Scholar
  19. J. B. Goodenough. Exception handling: Issues and a proposed notation. Comm. of the ACM, 18:683–696, Dec. 1975. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. J. Gosling, B. Joy, G. Steele, and G. Bracha. The Java Language Specification. Addison Wesley, 3rd edition, 2005. ISBN 0321246780.Google ScholarGoogle Scholar
  21. D. Grossman, G. Morrisett, T. Jim, M. Hicks, Y. Wang, and J. Cheney. Region-based memory management in Cyclone. In ACM SIGPLAN Conf. on Programming Language Design and Implementation (PLDI), pages 282–293, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. A. Hejlsberg, B. Venners, and B. Eckel. Remaining neutral on checked exceptions. http://www.artima.com/intv/ handcuffs.html, 2003.Google ScholarGoogle Scholar
  23. A. Hejlsberg, S. Wiltamuth, and P. Golde. The C# Programming Language. Addison-Wesley, 1st edition, Oct. 2003. ISBN 0321154916.Google ScholarGoogle Scholar
  24. D. Leijen. Koka: Programming with row polymorphic effect types. In 5th Workshop on Mathematically Structured Functional Programming, 2014.Google ScholarGoogle ScholarCross RefCross Ref
  25. X. Leroy and F. Pessaux. Type-based analysis of uncaught exceptions. ACM Trans. on Programming Languages and Systems, 22(2), Mar. 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. B. Liskov and A. Snyder. Exception handling in CLU. IEEE Transactions on Software Engineering, SE-5(6):546–558, Nov. 1979. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. B. H. Liskov and J. M. Wing. A behavioral notion of subtyping. ACM Trans. on Programming Languages and Systems, 16(6), Nov. 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. M. D. MacLaren. Exception handling in PL/I. In Proceedings of an ACM Conference on Language Design for Reliable Software, 1977. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. L. Mastrangelo, L. Ponzanelli, A. Mocci, M. Lanza, M. Hauswirth, and N. Nystrom. Use at your own risk: The Java Unsafe API in the wild. In 2015 ACM SIGPLAN Conf. on Object-Oriented Programming, Systems, Languages and Applications (OOPSLA), 2015. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. B. Meyer. Eiffel: The Language. 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. Microsoft Corporation. Microsoft C# Language Specifications. Microsoft Press, 2001. ISBN 0-7356-1448-2. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. R. Milner, M. Tofte, and R. Harper. The Definition of Standard ML. MIT Press, Cambridge, MA, 1990. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. J. G. Mitchell, W. Maybury, and R. Sweet. Mesa language manual. Technical Report CSL-78-1, Xerox Research Center, Palo Alto, CA, Feb. 1978.Google ScholarGoogle Scholar
  34. G. Nelson, editor. Systems Programming with Modula-3. Prentice-Hall, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. N. Nystrom, M. R. Clarkson, and A. C. Myers. Polyglot: An extensible compiler framework for Java. In 12th Int’l Conf. on Compiler Construction (CC’03), pages 138–152, Apr. 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. M. Odersky. The Scala Language Specification. EPFL, 2014. Version 2.9.Google ScholarGoogle Scholar
  37. OpenJDK javac. The javac compiler. http://hg.openjdk. java.net/.Google ScholarGoogle Scholar
  38. S. Peyton Jones. Haskell 98 language and libraries: the revised report. Cambridge University Press, 2003.Google ScholarGoogle Scholar
  39. A. Rastogi, A. Chaudhuri, and B. Hosmer. The ins and outs of gradual type inference. In 39th ACM Symp. on Principles of Programming Languages (POPL), 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. M. P. Robillard and G. C. Murphy. Designing robust Java programs with exceptions. In Proceedings of the 8th ACM SIGSOFT International Symposium on Foundations of Software Engineering (FSE-8), 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  41. L. Rytz, M. Odersky, and P. Haller. Lightweight polymorphic effects. In 26th European Conf. on Object-Oriented Programming, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  42. S. Sinha and M. J. Harrold. Analysis and testing of programs with exception handling constructs. IEEE Transactions on Software Engineering, 26(9), Sept. 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  43. G. L. Steele, Jr. Common LISP: the Language. Digital Press, second edition, 1990. ISBN 1-55558-041-6. Google ScholarGoogle ScholarDigital LibraryDigital Library
  44. B. Stroustrup. The C++ Programming Language. Addison-Wesley, 1987. Google ScholarGoogle ScholarDigital LibraryDigital Library
  45. SunFlow. SunFlow: the open-source rendering engine. Opensource software, 2007.Google ScholarGoogle Scholar
  46. Swift 2014. Swift programming language. https:// developer.apple.com/swift/resources, 2014.Google ScholarGoogle Scholar
  47. M. van Dooren and E. Steegmans. Combining the robustness of checked exceptions with the flexibility of unchecked exceptions using anchored exception declarations. In 20th ACM SIGPLAN Conf. on Object-Oriented Programming, Systems, Languages and Applications (OOPSLA), 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  48. B. Venners. Failure and exceptions: A conversation with James Gosling, Part II. http://www.artima.com/intv/solid.html, 2003.Google ScholarGoogle Scholar
  49. P. Wadler and S. Blott. How to make ad-hoc polymorphism less ad hoc. In 16th ACM Symp. on Principles of Programming Languages (POPL), 1989. Google ScholarGoogle ScholarDigital LibraryDigital Library
  50. P. Wadler and R. B. Findler. Well-typed programs can’t be blamed. In European Symposium on Programming, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  51. R. Waldhoff. Java’s checked exceptions were a mistake. http://radio-weblogs.com/0122027/stories/2003/ 04/01/JavasCheckedExceptionsWereAMistake.html, 2003.Google ScholarGoogle Scholar
  52. W. Weimer and G. C. Necula. Exceptional situations and program reliability. ACM Trans. on Programming Languages and Systems, 30(2), Mar. 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  53. Y. Zhang, M. C. Loring, G. Salvaneschi, B. Liskov, and A. C. Myers. Lightweight, flexible object-oriented generics. In 36th ACM SIGPLAN Conf. on Programming Language Design and Implementation (PLDI), pages 436–445, June 2015. Google ScholarGoogle ScholarDigital LibraryDigital Library
  54. Y. Zhang, G. Salvaneschi, Q. Beightol, B. Liskov, and A. C. Myers. Accepting blame: Expressive checked exceptions. Technical Report http://hdl.handle.net/1813/43784, Cornell University Computing and Information Science, Apr. 2016.Google ScholarGoogle Scholar

Index Terms

  1. Accepting blame for safe tunneled exceptions

    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 51, Issue 6
      PLDI '16
      June 2016
      726 pages
      ISSN:0362-1340
      EISSN:1558-1160
      DOI:10.1145/2980983
      • Editor:
      • Andy Gill
      Issue’s Table of Contents
      • cover image ACM Conferences
        PLDI '16: Proceedings of the 37th ACM SIGPLAN Conference on Programming Language Design and Implementation
        June 2016
        726 pages
        ISBN:9781450342612
        DOI:10.1145/2908080
        • General Chair:
        • Chandra Krintz,
        • Program Chair:
        • Emery Berger

      Copyright © 2016 ACM

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 2 June 2016

      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!