skip to main content
research-article
Public Access

Big types in little runtime: open-world soundness and collaborative blame for gradual type systems

Published:01 January 2017Publication History
Skip Abstract Section

Abstract

Gradual typing combines static and dynamic typing in the same language, offering programmers the error detection and strong guarantees of static types and the rapid prototyping and flexible programming idioms of dynamic types. Many gradually typed languages are implemented by translation into an untyped target language (e.g., Typed Clojure, TypeScript, Gradualtalk, and Reticulated Python). For such languages, it is desirable to support arbitrary interaction between translated code and legacy code in the untyped language while maintaining the type soundness of the translated code. In this paper we formalize this goal in the form of the open-world soundness criterion. We discuss why it is challenging to achieve open-world soundness using the traditional proxy-based approach for higher-order casts. However, the transient design satisfies open-world soundness. Indeed, we present a formal semantics for the transient design and prove that our semantics satisfies open-world soundness. In this paper we also solve a challenging problem for the transient design: how to provide blame tracking without proxies. We define a semantics for blame and prove the Blame Theorem. We also prove that the Gradual Guarantee holds for this system, ensuring that programs can be evolved freely between static and dynamic typing. Finally, we demonstrate that the runtime overhead of the transient approach is low in the context of Reticulated Python, an implementation of gradual typing for Python.

References

  1. M. Abadi, L. Cardelli, B. Pierce, and G. Plotkin. Dynamic typing in a statically-typed language. In POPL, 1989. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Amal Ahmed, Robert Bruce Findler, Jeremy G. Siek, and Philip Wadler. Blame for all. In POPL, 2011.Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Esteban Allende, Oscar Calla´u, Johan Fabry, Éric Tanter, and Markus Denker. Gradual typing for smalltalk. Science of Computer Programming, August 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Esteban Allende, Johan Fabry, and Éric Tanter. Cast insertion strategies for gradually-typed objects. In DLS, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Christopher Anderson and Sophia Drossopoulou. BabyJ - from object based to class based programming via types. In Workshop on Object Oriented Developments, 2003.Google ScholarGoogle Scholar
  6. Andrew W. Appel. Compiling with Continuations. Cambridge University Press, New York, NY, USA, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Gavin Bierman, Erik Meijer, and Mads Torgersen. In ECOOP. Springer-Verlag.Google ScholarGoogle Scholar
  8. Bard Bloom, John Field, Nathaniel Nystrom, Johan Östlund, Gregor Richards, Rok Strniˇsa, Jan Vitek, and Tobias Wrigstad. Thorn: Robust, concurrent, extensible scripting on the jvm. In OOPSLA, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Ambrose Bonnaire-Sergeant, Rowan Davies, and Sam Tobin-Hochstad. Practical optional types for clojure. In ESOP, 2016.Google ScholarGoogle ScholarCross RefCross Ref
  10. Gilad Bracha and David Griswold. Strongtalk: Typechecking smalltalk in a production environment. In OOPSLA, New York, NY, USA, 1993. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Robert Cartwright. User-defined data types as an aid to verifying LISP programs. In ICALP, 1976.Google ScholarGoogle Scholar
  12. Craig Chambers and the Cecil Group. The Cecil language: Specification and rationale. Technical report, Department of Computer Science and Engineering, University of Washington, Seattle, Washington, 2004.Google ScholarGoogle Scholar
  13. Christos Dimoulas, Robert Bruce Findler, Cormac Flanagan, and Matthias Felleisen. Correct blame for contracts: no more scapegoating. In POPL, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Christos Dimoulas, Sam Tobin-Hochstadt, and Matthias Felleisen. Complete monitors for behavioral contracts. In ESOP, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Eiffel. The Power of Design by Contract.Google ScholarGoogle Scholar
  16. Facebook. Hack, 2013.Google ScholarGoogle Scholar
  17. Robert Bruce Findler and Matthias Blume. Contracts as pairs of projections. In FLOPS, 2006.Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Robert Bruce Findler and Matthias Felleisen. Contracts for higherorder functions. In ICFP, 2002.Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Cormac Flanagan. Hybrid type checking. In POPL, Charleston, South Carolina, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Google. Dart: structured web apps, 2011.Google ScholarGoogle Scholar
  21. Kathryn E. Gray, Robert Bruce Findler, and Matthew Flatt. Finegrained interoperability through mirrors and contracts. In OOPSLA. ACM Press, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Robert Harper. Practical Foundations for Programming Languages. Cambridge University Press, New York, NY, USA, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. David Herman, Aaron Tomb, and Cormac Flanagan. Space-efficient gradual typing. In Trends in Functional Programming, 2007.Google ScholarGoogle Scholar
  24. Matthias Keil and Peter Thiemann. Blame assignment for higher-order contracts with intersection and union. In ICFP, 2015. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Matthias Keil and Peter Thiemann. Transparent object proxies in JavaScript. In ECOOP, 2015.Google ScholarGoogle Scholar
  26. Gianluca Mezzetti, Anders Møller, and Fabio Strocco. Type unsoundness in practice: An empirical study of Dart. In DLS, 2016. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Microsoft. Typescript, 2012.Google ScholarGoogle Scholar
  28. Aseem Rastogi, Avik Chaudhuri, and Basil Hosmer. The ins and outs of gradual type inference. In POPL, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Aseem Rastogi, Nikhil Swamy, Cedric Fournet, Gavin Bierman, and Panagiotis Vekris. Safe & efficient gradual typing for TypeScript. Technical Report MSR-TR-2014-99, Microsoft Research, 2014.Google ScholarGoogle Scholar
  30. Brianna M. Ren, John Toman, T. Stephen Strickland, and Jeffrey S. Foster. The ruby type checker. In Symposium on Applied Computing, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. Gregor Richards, Francesco Zappa Nardelli, and Jan Vitek. Concrete Types for TypeScript. In ECOOP, 2015.Google ScholarGoogle Scholar
  32. Manuel Serrano. Bigloo: a practical Scheme compiler. Inria-Rocquencourt, April 2002.Google ScholarGoogle Scholar
  33. Jeremy G. Siek and Walid Taha. Gradual typing for functional languages. In Scheme and Functional Programming Workshop, 2006.Google ScholarGoogle Scholar
  34. Jeremy G. Siek and Philip Wadler. Threesomes, with and without blame. In POPL, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. Jeremy G. Siek, Ronald Garcia, and Walid Taha. Exploring the design space of higher-order casts. In ESOP, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. Jeremy G. Siek, Michael M. Vitousek, Matteo Cimini, and John Tang Boyland. Refined criteria for gradual typing. In SNAPL ’15, 2015.Google ScholarGoogle Scholar
  37. Jeremy G. Siek, Michael M. Vitousek, Matteo Cimini, Sam Tobin-Hochstadt, and Ronald Garcia. Monotonic references for efficient gradual typing. In ESOP, 2015. Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. T. Stephen Strickland, Sam Tobin-Hochstadt, Robert Bruce Findler, and Matthew Flatt. Chaperones and impersonators: run-time support for reasonable interposition. In OOPSLA, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. Nikhil Swamy, Cedric Fournet, Aseem Rastogi, Karthikeyan Bhargavan, Juan Chen, Pierre-Yves Strub, and Gavin Bierman. Gradual typing embedded securely in javascript. In POPL, 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. Cameron Swords, Amr Sabry, and Sam Tobin-Hochstadt. Expressing contract monitors as patterns of communication. In ICFP, 2015. Google ScholarGoogle ScholarDigital LibraryDigital Library
  41. Asumu Takikawa, T. Stephen Strickland, Christos Dimoulas, Sam Tobin-Hochstadt, and Matthias Felleisen. Gradual typing for firstclass classes. In OOPSLA, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  42. Asumu Takikawa, Daniel Feltey, Ben Greenman, Max S. New, Jan Vitek, and Matthias Felleisen. Is sound gradual typing dead? In POPL, 2016. Google ScholarGoogle ScholarDigital LibraryDigital Library
  43. Satish Thatte. Quasi-static typing. In POPL, 1990. Google ScholarGoogle ScholarDigital LibraryDigital Library
  44. Sam Tobin-Hochstadt and Matthias Felleisen. Interlanguage migration: From scripts to programs. In DLS, 2006.Google ScholarGoogle Scholar
  45. Sam Tobin-Hochstadt and Matthias Felleisen. The design and implementation of Typed Scheme. In POPL, January 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  46. Sam Tobin-Hochstadt and Matthias Felleisen. Logical types for untyped languages. In ICFP, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  47. Michael M. Vitousek and Jeremy G. Siek. Gradual typing in an open world. Technical Report TR729, Indiana University, 2016.Google ScholarGoogle Scholar
  48. Michael M. Vitousek, Andrew M. Kent, Jeremy G. Siek, and Jim Baker. Design and evaluation of gradual typing for Python. In DLS, 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  49. Michael M. Vitousek, Cameron Swords, and Jeremy G. Siek. Big types in little runtime: Supplemental material, January 2017.Google ScholarGoogle Scholar
  50. Philip Wadler and Robert Bruce Findler. Well-typed programs can’t be blamed. In ESOP, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  51. Andrew K. Wright and Matthias Felleisen. A syntactic approach to type soundness. Information and Computation, 115(1):38–94, 1994. ISSN 0890-5401. Google ScholarGoogle ScholarDigital LibraryDigital Library
  52. Tobias Wrigstad, Francesco Zappa Nardelli, Sylvain Lebresne, Johan Östlund, and Jan Vitek. In POPL, 2010.Google ScholarGoogle Scholar

Index Terms

  1. Big types in little runtime: open-world soundness and collaborative blame for gradual type systems

      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 52, Issue 1
        POPL '17
        January 2017
        901 pages
        ISSN:0362-1340
        EISSN:1558-1160
        DOI:10.1145/3093333
        Issue’s Table of Contents
        • cover image ACM Conferences
          POPL '17: Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages
          January 2017
          901 pages
          ISBN:9781450346603
          DOI:10.1145/3009837

        Copyright © 2017 ACM

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 1 January 2017

        Check for updates

        Qualifiers

        • research-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!