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 ty…
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.
Formats available
You can view the full content in the following formats:
Supplementary Material
Auxiliary Archive (p456-takikawa-s.zip) An artifact containing a VirtualBox image that accompanies the paper “Is Sound Gradual Typing Dead?”.
- Download
- 1925.68 MB
References
[1]
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.
[2]
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.
[3]
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.
[4]
Esteban Allende, Johan Fabry, and Éric Tanter. Cast Insertion Strategies for Gradually-Typed Objects. In Proc. Dynamic Languages Symposium, pp. 27–36, 2013.
[5]
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.
[6]
Gavin Bierman, Martin Abadi, and Mads Torgersen. Understanding TypeScript. In Proc. European Conference on Object-Oriented Programming, pp. 257–281, 2014.
[7]
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.
[8]
Ambrose Bonnaire-Sergeant. A Practical Optional Type System for Clojure. Honour’s dissertation, University of Western Australia, 2012.
[9]
Gilad Bracha. Pluggable Type Systems. In Proc. OOPSLA Workshop on Revival of Dynamic Languages, 2004.
[10]
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.
[11]
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.
[12]
Robert Bruce Findler and Matthias Felleisen. Contracts for Higher-Order Functions. In Proc. ACM International Conference on Functional Programming, pp. 48–59, 2002.
[13]
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.
[14]
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.
[15]
David A. Moon. MACLISP Reference Manual. 1974.
[16]
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.
[17]
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.
[18]
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.
[19]
Gregor Richards, Francesco Zappa Nardelli, and Jan Vitek. Concrete Types for TypeScript. In Proc. European Conference on Object-Oriented Programming, pp. 76–100, 2015.
[20]
Michael Scriven. The Methodology of Evaluation. Perspectives of Curriculum Evaluation. Rand McNally, 1967.
[21]
Jeremy G. Siek and Walid Taha. Gradual Typing for Functional Languages. In Proc. Scheme and Functional Programming Workshop, 2006.
[22]
Jeremy G. Siek and Philip Wadler. Threesomes, with and without blame. In Proc. ACM Symposium on Principles of Programming Languages, pp. 365–376, 2010.
[23]
Vincent St-Amour, Leif Andersen, and Matthias Felleisen. Featurespecific Profiling. In Proc. International Conference on Compiler Construction, pp. 49–68, 2015.
[24]
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.
[25]
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.
[26]
Sam Tobin-Hochstadt and Matthias Felleisen. Interlanguage Migration: from Scripts to Programs. In Proc. Dynamic Languages Symposium, pp. 964–974, 2006.
[27]
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.
[28]
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.
[29]
Andrew K. Wright and Matthias Felleisen. A Syntactic Approach to Type Soundness. Information and Computation, pp. 38–94, 1994.
[30]
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.