skip to main content
research-article
Open Access

Complete monitors for gradual types

Published:10 October 2019Publication History
Skip Abstract Section

Abstract

In the context of gradual typing, type soundness guarantees the safety of typed code. When untyped code fails to respect types, a runtime check finds the discrepancy. As for untyped code, type soundness makes no promises; it does not protect untyped code from mistakes in type specifications and unwarranted blame.

To address the asymmetry, this paper adapts complete monitoring from the contract world to gradual typing. Complete monitoring strengthens plain soundness into a guarantee that catches problems with faulty type specifications. Furthermore, a semantics that satisfies complete monitoring can easily pinpoint the conflict between a type specification and a value. For gradual typing systems that fail complete monitoring, the technical framework provides a source-of-truth to assess the quality of blame.

Skip Supplemental Material Section

Supplemental Material

122-greenman

Presentation at OOPSLA '19

References

  1. Esteban Allende, Johan Fabry, and Éric Tanter. 2013. Cast Insertion Strategies for Gradually-Typed Objects. In DLS. 27–36.Google ScholarGoogle Scholar
  2. Henk Barendregt. 1981. The Lambda Calculus: Its Syntax and Semantics. North-Holland Publishing Company.Google ScholarGoogle Scholar
  3. Gavin Bierman, Martin Abadi, and Mads Torgersen. 2014. Understanding TypeScript. In ECOOP. 257–281.Google ScholarGoogle Scholar
  4. Matthias Blume and David A. McAllester. 2006. Sound and Complete Models of Contracts. JFP 16, 4-5 (2006), 375–414.Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Ambrose Bonnaire-Sergeant, Rowan Davies, and Sam Tobin-Hochstadt. 2016. Practical Optional Types for Clojure. In ESOP. 68–94.Google ScholarGoogle Scholar
  6. Giuseppe Castagna and Victor Lanvin. 2017. Gradual Typing with Union and Intersection Types. PACMPL 1, ICFP (2017), 41:1–41:28.Google ScholarGoogle Scholar
  7. Avik Chaudhuri, Panagiotis Vekris, Sam Goldman, Marshall Roch, and Gabriel Levy. 2017. Fast and Precise Type Checking for JavaScript. PACMPL 1, OOPSLA (2017), 56:1–56:30.Google ScholarGoogle Scholar
  8. Sheng Chen and John Peter Campora, III. 2019. Blame Tracking and Type Error Debugging. In SNAPL. 2:1–2:14.Google ScholarGoogle Scholar
  9. Benjamin W. Chung, Paley Li, Francesco Zappa Nardelli, and Jan Vitek. 2018. KafKa: Gradual Typing for Objects. In ECOOP. 12:1–12:23.Google ScholarGoogle Scholar
  10. Matteo Cimini and Jeremy Siek. 2017. Automatically Generating the Dynamic Semantics of Gradually Typed Languages. In POPL. 789–803.Google ScholarGoogle Scholar
  11. Christos Dimoulas, Robert Bruce Findler, Cormac Flanagan, and Matthias Felleisen. 2011. Correct Blame for Contracts: No More Scapegoating. In POPL. 215–226.Google ScholarGoogle Scholar
  12. Christos Dimoulas, Sam Tobin-Hochstadt, and Matthias Felleisen. 2012. Complete Monitors for Behavioral Contracts. In ESOP. 214–233.Google ScholarGoogle Scholar
  13. Asger Feldthaus and Anders Møller. 2014. Checking Correctness of TypeScript Interfaces for JavaScript Libraries. In OOPSLA. 1–16.Google ScholarGoogle Scholar
  14. Matthias Felleisen, Robert Bruce Findler, and Matthew Flatt. 2009. Semantics Engineering with PLT Redex. MIT Press.Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Robert Bruce Findler and Matthias Felleisen. 2002. Contracts for Higher-Order Functions. In ICFP. 48–59.Google ScholarGoogle Scholar
  16. Michael Greenberg. 2015. Space-Efficient Manifest Contracts. In POPL. 181–194.Google ScholarGoogle Scholar
  17. Michael Greenberg, Benjamin C. Pierce, and Stephanie Weirich. 2012. Contracts made manifest. JFP 22, 3 (2012), 225–274.Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Ben Greenman and Matthias Felleisen. 2018. A Spectrum of Type Soundness and Performance. PACMPL 2, ICFP (2018), 71:1–71:32.Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Ben Greenman, Matthias Felleisen, and Christos Dimoulas. 2019a. Complete Monitors for Gradual Types: Supplementary Material. Technical Report NU-CCIS-2019-001. Northeastern University.Google ScholarGoogle Scholar
  20. Ben Greenman, Asumu Takikawa, Max S. New, Daniel Feltey, Robert Bruce Findler, Jan Vitek, and Matthias Felleisen. 2019b. How to evaluate the performance of gradual type systems. JFP 29, e4 (2019), 1–45.Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Dan Grossman, Greg Morrisett, and Steve Zdancewic. 2000. Syntactic Type Abstraction. TOPLAS 22, 6 (2000), 1037–1080.Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. David Herman, Aaron Tomb, and Cormac Flanagan. 2010. Space-efficient Gradual Typing. HOSC 23, 2 (2010), 167–189.Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Ralf Hinze, Johan Jeuring, and Andres Löh. 2006. Typed Contracts for Functional Programming. In FLOPS. 208–225.Google ScholarGoogle Scholar
  24. Andre Murbach Maidl, Fabio Mascarenhas, and Roberto Ierusalimschy. 2015. A Formalization of Typed Lua. In DLS. 13–25.Google ScholarGoogle Scholar
  25. Jacob Matthews and Robert Bruce Findler. 2009. Operational Semantics for Multi-Language Programs. TOPLAS 31, 3 (2009), 1–44.Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Robin Milner. 1978. A Theory of Type Polymorphism in Programming. J. Comput. System Sci. 17, 3 (1978), 348–375.Google ScholarGoogle Scholar
  27. Scott Moore, Christos Dimoulas, Robert Bruce Findler, Matthew Flatt, and Stephen Chong. 2016. Extensible Access Control with Authorization Contracts. In OOPSLA. 214–233.Google ScholarGoogle Scholar
  28. Fabian Muehlboeck and Ross Tate. 2017. Sound Gradual Typing is Nominally Alive and Well. PACMPL 1, OOPSLA (2017), 56:1–56:30.Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Max S. New and Amal Ahmed. 2018. Graduality from Embedding-Projection Pairs. PACMPL 2, ICFP (2018), 73:1–73:30.Google ScholarGoogle Scholar
  30. Max S. New, Daniel R. Licata, and Amal Ahmed. 2019. Gradual Type Theory. PACMPL 3, POPL (2019), 15:1–15:31.Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. Aseem Rastogi, Nikhil Swamy, Cédric Fournet, Gavin Bierman, and Panagiotis Vekris. 2015. Safe & Efficient Gradual Typing for TypeScript. In POPL. 167–180.Google ScholarGoogle Scholar
  32. Gregor Richards, Ellen Arteca, and Alexi Turcotte. 2017. The VM Already Knew That: Leveraging Compile-Time Knowledge to Optimize Gradual Typing. PACMPL 1, OOPSLA (2017), 55:1–55:27.Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. Gregor Richards, Francesco Zappa Nardelli, and Jan Vitek. 2015. Concrete Types for TypeScript. In ECOOP. 76–100.Google ScholarGoogle Scholar
  34. Richard Roberts, Stefan Marr, Michael Homer, and James Noble. 2019. Transient Typechecks are (Almost) Free. In ECOOP. 15:1–15:29.Google ScholarGoogle Scholar
  35. Jeremy Siek, Peter Thiemann, and Philip Wadler. 2015a. Blame and Coercion: Together Again for the First Time. In PLDI. 425–435.Google ScholarGoogle Scholar
  36. Jeremy Siek, Michael M. Vitousek, Matteo Cimini, Sam Tobin-Hochstadt, and Ronald Garcia. 2015c. Monotonic References for Efficient Gradual Typing. In ESOP. 432–456.Google ScholarGoogle Scholar
  37. Jeremy G. Siek, Michael M. Vitousek, Matteo Cimini, and John Tang Boyland. 2015b. Refined Criteria for Gradual Typing. In SNAPL. 274–293.Google ScholarGoogle Scholar
  38. Vincent St-Amour and Neil Toronto. 2013. Experience Report: Applying Random Testing to a Base Type Environment. In ICFP. 351–356.Google ScholarGoogle Scholar
  39. Cameron Swords, Amr Sabry, and Sam Tobin-Hochstadt. 2018. An extended account of contract monitoring strategies as patterns of communication. JFP 28, e4 (2018), 1–47.Google ScholarGoogle Scholar
  40. Asumu Takikawa, Daniel Feltey, Earl Dean, Robert Bruce Findler, Matthew Flatt, Sam Tobin-Hochstadt, and Matthias Felleisen. 2015. Towards Practical Gradual Typing. In ECOOP. 4–27.Google ScholarGoogle Scholar
  41. Asumu Takikawa, T. Stephen Strickland, Christos Dimoulas, Sam Tobin-Hochstadt, and Matthias Felleisen. 2012. Gradual Typing for First-Class Classes. In OOPSLA. 793–810.Google ScholarGoogle Scholar
  42. Asumu Takikawa, T. Stephen Strickland, and Sam Tobin-Hochstadt. 2013. Constraining Delimited Control with Contracts. In ESOP. 229–248.Google ScholarGoogle Scholar
  43. Satish Thatte. 1990. Quasi-static Typing. In POPL. 367–381.Google ScholarGoogle Scholar
  44. Sam Tobin-Hochstadt and Matthias Felleisen. 2006. Interlanguage Migration: from Scripts to Programs. In DLS. 964–974.Google ScholarGoogle Scholar
  45. Sam Tobin-Hochstadt and Matthias Felleisen. 2008. The Design and Implementation of Typed Scheme. In POPL. 395–406.Google ScholarGoogle Scholar
  46. Sam Tobin-Hochstadt and Matthias Felleisen. 2010. Logical Types for Untyped Languages. In ICFP. 117–128.Google ScholarGoogle Scholar
  47. Sam Tobin-Hochstadt, Matthias Felleisen, Robert Bruce Findler, Matthew Flatt, Ben Greenman, Andrew M. Kent, Vincent St-Amour, T. Stephen Strickland, and Asumu Takikawa. 2017. Migratory Typing: Ten years later. In SNAPL. 17:1–17:17.Google ScholarGoogle Scholar
  48. Michael M. Vitousek. 2019. Gradual Typing for Python, Unguarded. Ph.D. Dissertation. Indiana University.Google ScholarGoogle Scholar
  49. Michael M. Vitousek, Cameron Swords, and Jeremy G. Siek. 2017. Big Types in Little Runtime: Open-World Soundness and Collaborative Blame for Gradual Type Systems. In POPL. 762–774.Google ScholarGoogle ScholarDigital LibraryDigital Library
  50. Philip Wadler. 2015. A Complement to Blame. In SNAPL. 309–320.Google ScholarGoogle Scholar
  51. Philip Wadler and Robert Bruce Findler. 2009. Well-typed Programs Can’t be Blamed. In ESOP. 1–15.Google ScholarGoogle Scholar
  52. Lucas Waye, Stephen Chong, and Christos Dimoulas. 2017. Whip: Higher-Order Contracts for Modern Services. PACMPL 1, ICFP (2017), 36:1–36:28.Google ScholarGoogle Scholar
  53. Tobias Wrigstad, Francesco Zappa Nardelli, Sylvain Lebresne, Johan Ostlund, and Jan Vitek. 2010. Integrating Typed and Untyped Code in a Scripting Language. In POPL. 377–388.Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Complete monitors for gradual types

        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 Proceedings of the ACM on Programming Languages
          Proceedings of the ACM on Programming Languages  Volume 3, Issue OOPSLA
          October 2019
          2077 pages
          EISSN:2475-1421
          DOI:10.1145/3366395
          Issue’s Table of Contents

          Copyright © 2019 ACM

          Publisher

          Association for Computing Machinery

          New York, NY, United States

          Publication History

          • Published: 10 October 2019
          Published in pacmpl Volume 3, Issue OOPSLA

          Permissions

          Request permissions about this article.

          Request Permissions

          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!