Abstract
Programmers can use gradual types to migrate programs to have more precise type annotations and thereby improve their readability, efficiency, and safety. Such migration requires an exploration of the migration space and can benefit from tool support, as shown in previous work. Our goal is to provide a foundation for better tool support by settling decidability questions about migration with gradual types. We present three algorithms and a hardness result for deciding key properties and we explain how they can be useful during an exploration. In particular, we show how to decide whether the migration space is finite, whether it has a top element, and whether it is a singleton. We also show that deciding whether it has a maximal element is NP-hard. Our implementation of our algorithms worked as expected on a suite of microbenchmarks.
Supplemental Material
- Gavin Bierman, Martín Abadi, and Mads Torgersen. 2014. Understanding TypeScript. In ECOOP 2014 – Object-Oriented Programming, Richard Jones (Ed.). Springer Berlin Heidelberg, Berlin, Heidelberg, 257–281.Google Scholar
- John Peter Campora, Sheng Chen, Martin Erwig, and Eric Walkingshaw. 2018. Migrating Gradual Types. Proc. ACM Program. Lang. 2, POPL (2018), 15:1–15:29.Google Scholar
Digital Library
- Giuseppe Castagna, Victor Lanvin, Tommaso Petrucciani, and Jeremy G. Siek. 2019. Gradual Typing: A New Perspective. Proc. ACM Program. Lang. 3, POPL, Article 16 (January 2019), 32 pages. Google Scholar
Digital Library
- Matteo Cimini and Jeremy Siek. 2016. The Gradualizer: A Methodology and Algorithm for Generating Gradual Type Systems. In Proceedings of POPL’16, ACM Symposium on Principles of Programming Languages.Google Scholar
Digital Library
- Ronald Garcia and Matteo Cimini. 2015. Principal Type Schemes for Gradual Programs. In Proceedings of the 42Nd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages. 303–315.Google Scholar
Digital Library
- Ronald Garcia, Alison M. Clark, and Éric Tanter. 2016. Abstracting Gradual Typing. In Proceedings of the 43rd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages. 429–442.Google Scholar
Digital Library
- Paola Giannini and Simona Ronchi Della Rocca. 1988. Characterization of Typings in Polymorphic Type Discipline. In Proceedings of LICS’88, Third Annual Symposium on Logic in Computer Science. 61–70.Google Scholar
Cross Ref
- Mostafa Hassan, Caterina Urban, Marco Eilers, and Peter Müller. 2018. MaxSMT-Based Type Inference for Python 3. In Proceedings of CAV’18, Computer-Aided Verification.Google Scholar
Cross Ref
- Thomas S. Heinze, Anders Møller, and Fabio Strocco. 2016. Type Safety Analysis for Dart. In DLS.Google Scholar
- Nico Lehmann and Éric Tanter. 2017. Gradual Refinement Types. In Proceedings of POPL, ACM Symposium on Principles of Programming Languages.Google Scholar
- Yusuke Miyazaki, Taro Sekiyama, and Atsushi Igarashi. 2018. Dynamic Type Inference for Gradual Hindley-Milner Typing. CoRR abs/1810.12619 (2018). arXiv: 1810.12619 http://arxiv.org/abs/1810.12619Google Scholar
- Torben Æ. Mogensen. 1992. Efficient Self-Interpretations in Lambda Calculus. Journal of Functional Programming 2, 3 (1992), 345–363. See also DIKU Report D–128, Sep 2, 1994.Google Scholar
Cross Ref
- Aseem Rastogi, Avik Chaudhuri, and Basil Hosmer. 2012. The Ins and Outs of Gradual Type Inference. SIGPLAN Not. 47, 1 (2012), 481–494.Google Scholar
Digital Library
- Jeremy Siek and Walid Taha. 2007. Gradual Typing for Objects. In Proceedings of the 21st European Conference on ObjectOriented Programming. 2–27.Google Scholar
Digital Library
- Jeremy G. Siek and Walid Taha. 2006. Gradual Typing for Functional Languages. In IN SCHEME AND FUNCTIONAL PROGRAMMING WORKSHOP. 81–92.Google Scholar
- Jeremy G. Siek and Manish Vachharajani. 2008. Gradual Typing with Unification-based Inference. In Proceedings of the 2008 Symposium on Dynamic Languages. 7:1–7:12.Google Scholar
- Jeremy G. Siek, Michael M. Vitousek, Matteo Cimini, and John Tang Boyland. 2015a. Refined Criteria for Gradual Typing. In SNAPL. 274–293.Google Scholar
- Jeremy G. Siek, Michael M. Vitousek, Matteo Cimini, Sam Tobin-Hochstadt, and Ronald Garcia. 2015b. Monotonic References for Efficient Gradual Typing. In Proceedings of the 24th European Symposium on Programming on Programming Languages and Systems - Volume 9032. 432–456.Google Scholar
Digital Library
- Sam Tobin-Hochstadt and Matthias Felleisen. 2008. The Design and Implementation of Typed Scheme. In Proceedings of the 35th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL ’08). ACM, New York, NY, USA, 395–406. Google Scholar
Digital Library
- Michael M. Vitousek, Andrew M. Kent, Jeremy G. Siek, and Jim Baker. 2014. Design and Evaluation of Gradual Typing for Python. SIGPLAN Not. 50, 2 (2014), 45–56.Google Scholar
Digital Library
- Zhaogui Xu, Xiangyu Zhang, Lin Chen, Kexin Pei, and Baowen Xu. 2016. Python probabilistic type inference with natural language support. In Proceedings of 24th ACM SIGSOFT International Symposium on Foundations of Software Engineering (FSE). 607–618.Google Scholar
Digital Library
Index Terms
What is decidable about gradual types?
Recommendations
Migrating gradual types
Gradual typing allows programs to enjoy the benefits of both static typing and dynamic typing. While it is often desirable to migrate a program from more dynamically-typed to more statically-typed or vice versa, gradual typing itself does not provide a ...
Acyclic Recursion with Polymorphic Types and Underpecification
ICAART 2016: Proceedings of the 8th International Conference on Agents and Artificial IntelligenceThe paper extends Moschovakis higher-order type theory of acyclic recursion by adding type polymorphism. We extend the type system of the theory to model parametric information that pertains to underspecified types. Different kinds of type polymorphism ...
Gradual typing with union and intersection types
We propose a type system for functional languages with gradual types and set-theoretic type connectives and prove its soundness. In particular, we show how to lift the definition of the domain and result type of an application from non-gradual types to ...






Comments