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 way to facilitate this migration. This places the burden on programmers who have to manually add or remove type annotations. Besides the general challenge of adding type annotations to dynamically typed code, there are subtle interactions between these annotations in gradually typed code that exacerbate the situation. For example, to migrate a program to be as static as possible, in general, all possible combinations of adding or removing type annotations from parameters must be tried out and compared.
In this paper, we address this problem by developing migrational typing, which efficiently types all possible ways of adding or removing type annotations from a gradually typed program. The typing result supports automatically migrating a program to be as static as possible, or introducing the least number of dynamic types necessary to remove a type error. The approach can be extended to support user-defined criteria about which annotations to modify. We have implemented migrational typing and evaluated it on large programs. The results show that migrational typing scales linearly with the size of the program and takes only 2–4 times longer than plain gradual typing.
Wed 10 JanDisplayed time zone: Tijuana, Baja California change
13:40 - 15:20 | Interpretation and EvaluationResearch Papers at Watercourt Chair(s): Atsushi Igarashi Kyoto University, Japan | ||
13:40 25mTalk | Unifying Analytic and Statically-Typed Quasiquotes Research Papers Lionel Parreaux EPFL, Antoine Voizard University of Pennsylvannia, Amir Shaikhha EPFL, Christoph E. Koch EPFL Pre-print | ||
14:05 25mTalk | Jones-Optimal Partial Evaluation by Specialization-Safe Normalization Research Papers | ||
14:30 25mTalk | Migrating Gradual Types Research Papers John Peter Campora ULL Lafayette, Sheng Chen University of Louisiana at Lafayette, Martin Erwig Oregon State University, Eric Walkingshaw Oregon State University | ||
14:55 25mTalk | Intrinsically-Typed Definitional Interpreters for Imperative Languages Research Papers Casper Bach Poulsen Delft University of Technology, Arjen Rouvoet Delft University of Technology, Andrew Tolmach Portland State University, Robbert Krebbers Delft University of Technology, Eelco Visser Delft University of Technology DOI Pre-print |