Abstract
Programmers have come to embrace dynamically-typed languages for prototyping and delivering large and complex systems. When it comes to maintaining and evolving these systems, the lack of explicit static typing becomes a bottleneck. In response, researchers have explored the idea of gradually-typed programming languages which allow the incremental addition of type annotations to software written in one of these untyped languages. Some of these new, hybrid languages insert run-time checks at the boundary between typed and untyped code to establish type soundness for the overall system. With sound gradual typing, programmers can rely on the language implementation to provide meaningful error messages when type invariants are violated. While most research on sound gradual typing remains theoretical, the few emerging implementations suffer from performance overheads due to these checks. None of the publications on this topic comes with a comprehensive performance evaluation. Worse, a few report disastrous numbers. In response, this paper proposes a method for evaluating the performance of gradually-typed programming languages. The method hinges on exploring the space of partial conversions from untyped to typed. For each benchmark, the performance of the different versions is reported in a synthetic metric that associates runtime overhead to conversion effort. The paper reports on the results of applying the method to Typed Racket, a mature implementation of sound gradual typing, using a suite of real-world programs of various sizes and complexities. Based on these results the paper concludes that, given the current state of implementation technologies, sound gradual typing faces significant challenges. Conversely, it raises the question of how implementations could reduce the overheads associated with soundness and how tools could be used to steer programmers clear from pathological cases.
Supplemental Material
Available for Download
An artifact containing a VirtualBox image that accompanies the paper "Is Sound Gradual Typing Dead?".
- Martin Abadi, Luca Cardelli, Benjamin C. Pierce, and Gordon D. Plotkin. Dynamic Typing in a Statically Typed Language. ACM Transactions on Programming Languages and Systems 13(2), pp. 237–268, 1991. Google Scholar
Digital Library
- Esteban Allende, Oscar Callaú, Johan Fabry, Éric Tanter, and Marcus Denker. Gradual typing for Smalltalk. Science of Computer Programming 96(1), pp. 52–69, 2013. Google Scholar
Digital Library
- Esteban Allende, Johan Fabry, Ronald Garcia, and Éric Tanter. Confined Gradual Typing. In Proc. ACM Conference on Object-Oriented Programming, Systems, Languages and Applications, pp. 251–270, 2014. Google Scholar
Digital Library
- Esteban Allende, Johan Fabry, and Éric Tanter. Cast Insertion Strategies for Gradually-Typed Objects. In Proc. Dynamic Languages Symposium, pp. 27–36, 2013. Google Scholar
Digital Library
- Spenser Bauman, Carl Friedrich Bolz, Robert Hirschfield, Vasily Kirilichev, Tobias Pape, Jeremy G. Siek, and Sam Tobin-Hochstadt. Pycket: A Tracing JIT For a Functional Language. In Proc. ACM International Conference on Functional Programming, pp. 22–34, 2015. Google Scholar
Digital Library
- Gavin Bierman, Martin Abadi, and Mads Torgersen. Understanding TypeScript. In Proc. European Conference on Object-Oriented Programming, pp. 257–281, 2014.Google Scholar
- Bard Bloom, John Field, Nathaniel Nystrom, Johan Östlund, Gregor Richards, Rok Strniša, Jan Vitek, and Tobias Wrigstad. Thorn: Robust, Concurrent, Extensible Scripting on the JVM. In Proc. ACM Conference on Object-Oriented Programming, Systems, Languages and Applications, pp. 117–136, 2009. Google Scholar
Digital Library
- Ambrose Bonnaire-Sergeant. A Practical Optional Type System for Clojure. Honour’s dissertation, University of Western Australia, 2012.Google Scholar
- Gilad Bracha. Pluggable Type Systems. In Proc. OOPSLA Workshop on Revival of Dynamic Languages, 2004.Google Scholar
- Gilad Bracha and David Griswold. Strongtalk: Typechecking Smalltalk in a Production Environment. In Proc. ACM Conference on Object-Oriented Programming, Systems, Languages and Applications, pp. 215–230, 1993. Google Scholar
Digital Library
- Mason Chang, Bernd Mathiske, Edwin Smith, Avik Chaudhuri, Andreas Gal, Michael Bebenita, Christian Wimmer, and Michael Franz. The Impact of Optional Type Information on JIT Compilation of Dynamically Typed Languages. In Proc. Dynamic Languages Symposium, pp. 13–24, 2011. Google Scholar
Digital Library
- Robert Bruce Findler and Matthias Felleisen. Contracts for Higher-Order Functions. In Proc. ACM International Conference on Functional Programming, pp. 48–59, 2002. Google Scholar
Digital Library
- Fritz Henglein and Jakob Rehof. Safe Polymorphic Type Inference for a Dynamically Typed Language: Translating Scheme to ML. In Proc. ACM International Conference on Functional Programming Languages and Computer Architecture, pp. 192–203, 1995. Google Scholar
Digital Library
- André Murbach Maidl, Fabio Mascarenhas, and Roberto Ierusalimschy. Typed Lua: An Optional Type System for Lua. In Proc. Workshop on Dynamic Languages and Applications, pp. 1–10, 2014. Google Scholar
Digital Library
- David A. Moon. MACLISP Reference Manual. 1974.Google Scholar
- Phúc C. Nguy˜ên, Sam Tobin-Hochstadt, and David Van Horn. Soft Contract Verification. In Proc. ACM International Conference on Functional Programming, pp. 139–152, 2014. Google Scholar
Digital Library
- Matthew M. Papi, Mahmood Ali, Telmo Louis Correa, Jr., Jeff H. Perkins, and Michael D. Ernst. Practical Pluggable Types for Java. In Proc. International Symposium on Software Testing and Analysis, pp. 201–212, 2008. Google Scholar
Digital Library
- Aseem Rastogi, Nikhil Swamy, Cédric Fournet, Gavin Bierman, and Panagiotis Vekris. Safe & Efficient Gradual Typing for TypeScript. In Proc. ACM Symposium on Principles of Programming Languages, pp. 167––180, 2015. Google Scholar
Digital Library
- Gregor Richards, Francesco Zappa Nardelli, and Jan Vitek. Concrete Types for TypeScript. In Proc. European Conference on Object-Oriented Programming, pp. 76–100, 2015.Google Scholar
- Michael Scriven. The Methodology of Evaluation. Perspectives of Curriculum Evaluation. Rand McNally, 1967.Google Scholar
- Jeremy G. Siek and Walid Taha. Gradual Typing for Functional Languages. In Proc. Scheme and Functional Programming Workshop, 2006.Google Scholar
- Jeremy G. Siek and Philip Wadler. Threesomes, with and without blame. In Proc. ACM Symposium on Principles of Programming Languages, pp. 365–376, 2010. Google Scholar
Digital Library
- Vincent St-Amour, Leif Andersen, and Matthias Felleisen. Featurespecific Profiling. In Proc. International Conference on Compiler Construction, pp. 49–68, 2015.Google Scholar
- Vincent St-Amour, Sam Tobin-Hochstadt, and Matthias Felleisen. Optimization coaching. In Proc. ACM Conference on Object-Oriented Programming, Systems, Languages and Applications, pp. 163–178, 2012. Google Scholar
Digital Library
- Asumu Takikawa, Daniel Feltey, Earl Dean, Robert Bruce Findler, Matthew Flatt, Sam Tobin-Hochstadt, and Matthias Felleisen. Towards Practical Gradual Typing. In Proc. European Conference on Object-Oriented Programming, pp. 4–27, 2015.Google Scholar
- Sam Tobin-Hochstadt and Matthias Felleisen. Interlanguage Migration: from Scripts to Programs. In Proc. Dynamic Languages Symposium, pp. 964–974, 2006. Google Scholar
Digital Library
- Sam Tobin-Hochstadt, Vincent St-Amour, Ryan Culpepper, Matthew Flatt, and Matthias Felleisen. Languages as Libraries. In Proc. ACM Conference on Programming Language Design and Implementation, pp. 132–141, 2011. Google Scholar
Digital Library
- Michael M. Vitousek, Andrew Kent, Jeremy G. Siek, and Jim Baker. Design and Evaluation of Gradual Typing for Python. In Proc. Dynamic Languages Symposium, pp. 45–56, 2014. Google Scholar
Digital Library
- Andrew K. Wright and Matthias Felleisen. A Syntactic Approach to Type Soundness. Information and Computation, pp. 38–94, 1994. Google Scholar
Digital Library
- Tobias Wrigstad, Francesco Zappa Nardelli, Sylvain Lebresne, Johan Östlund, and Jan Vitek. Integrating Typed and Untyped Code in a Scripting Language. In Proc. ACM Symposium on Principles of Programming Languages, pp. 377–388, 2010. Google Scholar
Digital Library
Index Terms
Is sound gradual typing dead?
Recommendations
Gradual typing: a new perspective
We define a new, more semantic interpretation of gradual types and use it to ``gradualize'' two forms of polymorphism: subtyping polymorphism and implicit parametric polymorphism. In particular, we use the new interpretation to define three gradual type ...
Is sound gradual typing dead?
POPL '16: Proceedings of the 43rd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming LanguagesProgrammers have come to embrace dynamically-typed languages for prototyping and delivering large and complex systems. When it comes to maintaining and evolving these systems, the lack of explicit static typing becomes a bottleneck. In response, ...
Sound gradual typing: only mostly dead
While gradual typing has proven itself attractive to programmers, many systems have avoided sound gradual typing due to the run time overhead of enforcement. In the context of sound gradual typing, both anecdotal and systematic evidence has suggested ...






Comments