Abstract
Many language designers have adopted gradual typing. However, there remains open questions regarding how to gradualize languages. Cimini and Siek (2016) created a methodology and algorithm to automatically generate the type system of a gradually typed language from a fully static version of the language. In this paper, we address the next challenge of how to automatically generate the dynamic semantics of gradually typed languages. Such languages typically use an intermediate language with explicit casts.
Our first result is a methodology for generating the syntax, type system, and dynamic semantics of the intermediate language with casts. Next, we present an algorithm that formalizes and automates the methodology, given a language definition as input. We show that our approach is general enough to automatically gradualize several languages, including features such as polymorphism, recursive types and exceptions. We prove that our algorithm produces languages that satisfy the key correctness criteria of gradual typing. Finally, we implement the algorithm, generating complete specifications of gradually typed languages in lambda-Prolog, including executable interpreters.
- Amal Ahmed, Robert Bruce Findler, Jeremy G. Siek, and Philip Wadler. Blame for all. In Proceedings of the 38th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL ’11, pages 201–214, New York, NY, USA, 2011. ACM. ISBN 978-1-4503-0490-0.Google Scholar
Digital Library
- Roberto M. Amadio and Luca Cardelli. Subtyping recursive types. In Proceedings of the 18th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL ’91, pages 104–118, New York, NY, USA, 1991. ACM. ISBN 0-89791-419-8. Google Scholar
Digital Library
- David Baelde, Kaustuv Chaudhuri, Andrew Gacek, Dale Miller, Gopalan Nadathur, Alwen Tiu, and Yuting Wang. Abella: A system for reasoning about relational specifications. Journal of Formalized Reasoning, 7(2), 2014.Google Scholar
- Gavin Bierman, Mart´ın Abadi, and Mads Torgersen. Understanding TypeScript. In Richard Jones, editor, ECOOP 2014 – Object-Oriented Programming, volume 8586 of Lecture Notes in Computer Science, pages 257–281. Springer Berlin Heidelberg, 2014. Google Scholar
Digital Library
- Matteo Cimini and Jeremy G. Siek. The gradualizer: a methodology and algorithm for generating gradual type systems. In Symposium on Principles of Programming Languages, POPL, January 2016. Google Scholar
Digital Library
- Benjamin Delaware, Bruno C. d. S. Oliveira, and Tom Schrijvers. Meta-theory à la carte. In Proceedings of the 40th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL ’13, pages 207–218, New York, NY, USA, 2013. ACM. ISBN 978-1-4503-1832-7. Google Scholar
Digital Library
- Robert Bruce Findler and Matthias Felleisen. Contracts for higherorder functions. Technical Report NU-CCS-02-05, Northeastern University, 2002.Google Scholar
- Robert Bruce Findler, Matthew Flatt, and Matthias Felleisen. Contracts for higher-order functions. In International Conference on Functional Programming, ICFP, pages 48–59, October 2002. Google Scholar
Digital Library
- Robert Bruce Findler, Matthew Flatt, and Matthias Felleisen. Semantic casts: Contracts and structural subtyping in a nominal world. In European Conference on Object-Oriented Programming, 2004.Google Scholar
- Cormac Flanagan. Hybrid type checking. In POPL 2006: The 33rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 245–256, Charleston, South Carolina, January 2006. Google Scholar
Digital Library
- Ronal Garcia, Alison M. Clark, and Éric Tanter. Abstracting gradual typing. In Proceedings of the 43rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2016, St Petersburg, FL, USA, January 20-22. ACM Press, 2016. Google Scholar
Digital Library
- Álvaro Garc´ıa-Pérez, Pablo Nogueira, and Ilya Sergey. Deriving interpretations of the gradually-typed lambda calculus. In Proceedings of the ACM SIGPLAN 2014 Workshop on Partial Evaluation and Program Manipulation, PEPM ’14, pages 157–168, New York, NY, USA, 2014. ACM. ISBN 978-1-4503-2619-3. Google Scholar
Digital Library
- Robert Harper. Practical Foundations for Programming Languages. Cambridge University Press, New York, NY, USA, 2012. Google Scholar
Digital Library
- ISBN 1107029570, 9781107029576.Google Scholar
- Anders Hejlsberg. C# 4.0 and beyond. Microsoft Channel 9 Blog, April 2010.Google Scholar
- Anders Hejlsberg. Introducing TypeScript. Microsoft Channel 9 Blog, 2012.Google Scholar
- David Herman, Aaron Tomb, and Cormac Flanagan. Space-efficient gradual typing. In Trends in Functional Prog. (TFP), page XXVIII, April 2007.Google Scholar
- David Herman, Aaron Tomb, and Cormac Flanagan. Space-efficient gradual typing. Higher-Order and Symbolic Computation, 23(2):167– 189, 2010. Google Scholar
Digital Library
- Atsushi Igarashi, Benjamin C. Pierce, and Philip Wadler. Featherweight java: a minimal core calculus for java and gj. ACM Transactions on Programming Languages and Systems, 23(3):396–450, 2001. ISSN 0164-0925. Google Scholar
Digital Library
- Matthias Keil and Peter Thiemann. Transparent object proxies in javascript. In European Conference on Object-Oriented Programming, 2015.Google Scholar
- Nicolás Lehmann and Éric Tanter. Gradual refinement types. In Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages, POPL 2017, Paris, Fr, January 18-20. ACM Press, 2017. Google Scholar
Digital Library
- Xinming Ou, Gang Tan, Yitzhak Mandelbaum, and David Walker. Dynamic typing with dependent types (extended abstract). In 3rd IFIP International Conference on Theoretical Computer Science, August 2004.Google Scholar
- Christopher Schwaab and Jeremy G. Siek. Modular type-safety proofs in agda. In Proceedings of the 7th Workshop on Programming Languages Meets Program Verification, PLPV ’13, pages 3–12, New York, NY, USA, 2013. ACM. ISBN 978-1-4503-1860-0. Google Scholar
Digital Library
- Jeremy G. Siek and Ronald Garcia. Interpretations of the graduallytyped lambda calculus. In Scheme and Functional Programming Workshop, 2012. Google Scholar
Digital Library
- Jeremy G. Siek and Walid Taha. Gradual typing for functional languages. In Scheme and Functional Programming Workshop, pages 81–92, September 2006.Google Scholar
- Jeremy G. Siek and Philip Wadler. Threesomes, with and without blame. In Proceedings for the 1st workshop on Script to Program Evolution, STOP ’09, pages 34–46, New York, NY, USA, 2009. ACM. Google Scholar
Digital Library
- Jeremy G. Siek and Philip Wadler. Threesomes, with and without blame. In Proceedings of the 37th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL ’10, pages 365–376, New York, NY, USA, 2010. ACM. ISBN 978-1- 60558-479-9. Google Scholar
Digital Library
- Jeremy G. Siek, Peter Thiemann, and Philip Wadler. Blame and coercion: Together again for the first time. In Conference on Programming Language Design and Implementation, PLDI, June 2015. Google Scholar
Digital Library
- Jeremy G. Siek, Michael M. Vitousek, Matteo Cimini, and John Tang Boyland. Refined criteria for gradual typing. In SNAPL: Summit on Advances in Programming Languages, LIPIcs: Leibniz International Proceedings in Informatics, May 2015.Google Scholar
- The Dart Team. Dart Programming Language Specification. Google, 1.2 edition, March 2014.Google Scholar
- Sam Tobin-Hochstadt and Matthias Felleisen. Interlanguage migration: From scripts to programs. In Dynamic Languages Symposium, 2006.Google Scholar
- Sam Tobin-Hochstadt and Matthias Felleisen. The design and implementation of Typed Scheme. In Symposium on Principles of Programming Languages, January 2008. Google Scholar
Digital Library
- Tom Van Cutsem and Mark S. Miller. Proxies: Design principles for robust object-oriented intercession apis. In Proceedings of the 6th Symposium on Dynamic Languages, DLS ’10, pages 59–72, New York, NY, USA, 2010. ACM. ISBN 978-1-4503-0405-4. Google Scholar
Digital Library
- Julien Verlaguet. Facebook: Analyzing PHP statically. In Commercial Users of Functional Programming (CUFP), 2013.Google Scholar
- Michael M. Vitousek, Andrew M. Kent, Jeremy G. Siek, and Jim Baker. Design and evaluation of gradual typing for Python. In Symposium on Dynamic Languages, DLS ’14, pages 1–16, 2014. Google Scholar
Digital Library
- Philip Wadler and Robert Bruce Findler. Well-typed programs can’t be blamed. In Workshop on Scheme and Functional Programming, pages 15–26, 2007.Google Scholar
- Philip Wadler and Robert Bruce Findler. Well-typed programs can’t be blamed. In European Symposium on Programming, ESOP, pages 1–16, March 2009. 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 Symposium on Principles of Programming Languages, POPL, pages 377–388, 2010. Google Scholar
Digital Library
Index Terms
Automatically generating the dynamic semantics of gradually typed languages
Recommendations
The gradualizer: a methodology and algorithm for generating gradual type systems
POPL '16: Proceedings of the 43rd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming LanguagesMany languages are beginning to integrate dynamic and static typing. Siek and Taha offered gradual typing as an approach to this integration that provides a coherent and full-span migration between the two disciplines. However, the literature lacks a ...
The gradualizer: a methodology and algorithm for generating gradual type systems
POPL '16Many languages are beginning to integrate dynamic and static typing. Siek and Taha offered gradual typing as an approach to this integration that provides a coherent and full-span migration between the two disciplines. However, the literature lacks a ...
Automatically generating the dynamic semantics of gradually typed languages
POPL '17: Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming LanguagesMany language designers have adopted gradual typing. However, there remains open questions regarding how to gradualize languages. Cimini and Siek (2016) created a methodology and algorithm to automatically generate the type system of a gradually typed ...







Comments