skip to main content
research-article
Open Access
Artifacts Available
Artifacts Evaluated & Functional

On polymorphic gradual typing

Published:29 August 2017Publication History
Skip Abstract Section

Abstract

We study an extension of gradual typing—a method to integrate dynamic typing and static typing smoothly in a single language—to parametric polymorphism and its theoretical properties, including conservativity of typing and semantics over both statically and dynamically typed languages, type safety, blame-subtyping theorem, and the gradual guarantee—the so-called refined criteria, advocated by Siek et al. We develop System FG, which is a gradually typed extension of System F with the dynamic type and a new type consistency relation, and translation to a new polymorphic blame calculus System FC, which is based on previous polymorphic blame calculi by Ahmed et al. The design of System FG and System FC, geared to the criteria, is influenced by the distinction between static and gradual type variables, first observed by Garcia and Cimini. This distinction is also useful to execute statically typed code without incurring additional overhead to manage type names as in the prior calculi. We prove that System FG satisfies most of the criteria: all but the hardest property of the gradual guarantee on semantics. We show that a key conjecture to prove the gradual guarantee leads to the Jack-of-All-Trades property, conjectured as an important property of the polymorphic blame calculus by Ahmed et al.

Skip Supplemental Material Section

Supplemental Material

References

  1. Martín Abadi, Luca Cardelli, Benjamin Pierce, and Gordon Plotkin. 1991. Dynamic Typing in a Statically Typed Language. 13, 2 (1991), 237–268.Google ScholarGoogle Scholar
  2. Martín Abadi, Luca Cardelli, Benjamin C. Pierce, and Didier Rémy. 1995. Dynamic Typing in Polymorphic Languages. J. Funct. Program. 5, 1 (1995), 111–130. Google ScholarGoogle ScholarCross RefCross Ref
  3. Amal Ahmed, Robert Bruce Findler, Jacob Matthews, and Philip Wadler. 2009. Blame for all. In Proc. of Workshop on Stript to Program Evolution. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Amal Ahmed, Robert Bruce Findler, Jeremy G. Siek, and Philip Wadler. 2011. Blame for all. In Proceedings of the 38th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2011, Austin, TX, USA, January 26-28, 2011. 201–214. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Amal Ahmed, Dustin Jamner, Jeremy G. Siek, and Philip Wadler. 2017. Theorems for Free for Free: Parametricity, With and Without Types. Proc. ACM Program. Lang. 1, ICFP, Article 39 (sep 2017), 28 pages. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Amal Ahmed, James T. Perconti, Jeremy G. Siek, and Philip Wadler. 2013. Blame for All (revised). (2013).Google ScholarGoogle Scholar
  7. Felipe Bañados Schwerter, Ronald Garcia, and Éric Tanter. 2014. A theory of gradual effect systems. In Proceedings of the 19th ACM SIGPLAN international conference on Functional programming, Gothenburg, Sweden, September 1-3, 2014. 283–295.Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. João Filipe Belo, Michael Greenberg, Atsushi Igarashi, and Benjamin C. Pierce. 2011. Polymorphic Contracts. In Programming Languages and Systems - 20th European Symposium on Programming, ESOP 2011, Held as Part of the Joint European Conferences on Theory and Practice of Software, ETAPS 2011, Saarbrücken, Germany, March 26-April 3, 2011. Proceedings. 18–37. Google ScholarGoogle ScholarCross RefCross Ref
  9. Gavin M. Bierman, Martín Abadi, and Mads Torgersen. 2014. Understanding TypeScript. In ECOOP 2014 - Object-Oriented Programming - 28th European Conference, Uppsala, Sweden, July 28 - August 1, 2014. Proceedings. 257–281. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Gavin M. Bierman, Erik Meijer, and Mads Torgersen. 2010. Adding Dynamic Types to C # . In ECOOP 2010 - Object-Oriented Programming, 24th European Conference, Maribor, Slovenia, June 21-25, 2010. Proceedings. 76–100.Google ScholarGoogle Scholar
  11. Ambrose Bonnaire-Sergeant, Rowan Davies, and Sam Tobin-Hochstadt. 2016. Practical Optional Types for Clojure. In Programming Languages and Systems - 25th European Symposium on Programming, ESOP 2016, Held as Part of the European Joint Conferences on Theory and Practice of Software, ETAPS 2016, Eindhoven, The Netherlands, April 2-8, 2016, Proceedings. 68–94. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Luca Cardelli. 1986. A Polymorphic λ-calculus with Type:Type. Technical Report 10. DEC Systems Research Center.Google ScholarGoogle Scholar
  13. Matteo Cimini and Jeremy G. Siek. 2016. The gradualizer: a methodology and algorithm for generating gradual type systems. In Proceedings of the 43rd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2016, St. Petersburg, FL, USA, January 20 - 22, 2016. 443–455. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Matteo Cimini and Jeremy G. Siek. 2017. Automatically generating the dynamic semantics of gradually typed languages. In Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages, POPL 2017, Paris, France, January 18-20, 2017. 789–803. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Facebook. 2017. The Hack Programming Language. (2017). http://hacklang.org/.Google ScholarGoogle Scholar
  16. Cormac Flanagan. 2006. Hybrid type checking. In Proceedings of the 33rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2006, Charleston, South Carolina, USA, January 11-13, 2006. 245–256. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. 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, POPL 2015, Mumbai, India, January 15-17, 2015. 303–315. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. 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, POPL 2016, St. Petersburg, FL, USA, January 20 -22, 2016. 429–442. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Jean-Yves Girard. 1972. Interprétation fonctionnelle et élimination des coupures de l’arithmétique d’ordre supérieur. Thèse d’état. Université Paris VII. Summary in Proceedings of the Second Scandinavian Logic Symposium (J.E. Fenstad, editor), North-Holland, 1971 (pp. 63–92).Google ScholarGoogle Scholar
  20. Michael Greenberg, Benjamin C. Pierce, and Stephanie Weirich. 2010. Contracts made manifest. In Proceedings of the 37th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2010, Madrid, Spain, January 17-23, 2010. 353–364. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Jessica Gronski, Kenneth Knowles, Aaron Tomb, Stephen N. Freund, and Cormac Flanagan. 2006. Sage: Hybrid checking for flexible specifications. In Scheme and Functional Programming Workshop.Google ScholarGoogle Scholar
  22. Arjun Guha, Jacob Matthews, Robert Bruce Findler, and Shriram Krishnamurthi. 2007. Relationally-parametric polymorphic contracts. In Proceedings of the 2007 Symposium on Dynamic Languages, DLS 2007, October 22, 2007, Montreal, Quebec, Canada. 29–40. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Lintaro Ina and Atsushi Igarashi. 2011. Gradual typing for generics. In Proceedings of the 26th Annual ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications, OOPSLA 2011, part of SPLASH 2011, Portland, OR, USA, October 22 - 27, 2011. 609–624. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Jacob Matthews and Amal Ahmed. 2008. Parametric Polymorphism through Run-Time Sealing or, Theorems for Low, Low Prices!. In Programming Languages and Systems, 17th European Symposium on Programming, ESOP 2008, Held as Part of the Joint European Conferences on Theory and Practice of Software, ETAPS 2008, Budapest, Hungary, March 29-April 6, 2008. Proceedings. 16–31.Google ScholarGoogle Scholar
  25. Jacob Matthews and Robert Bruce Findler. 2009. Operational semantics for multi-language programs. ACM Trans. Program. Lang. Syst. 31, 3 (2009), 12:1–12:44.Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Erik Meijer and Peter Drayton. 2004. Static Typing Where Possible, Dynamic Typing When Needed: The End of the Cold War Between Programming Languages. In OOPSLA’04 Workshop on Revival of Dynamic Languages.Google ScholarGoogle Scholar
  27. James H. Morris, Jr. 1973. Protection in Programming Languages. 16, 1 (Jan. 1973), 15–21.Google ScholarGoogle Scholar
  28. Georg Neis, Derek Dreyer, and Andreas Rossberg. 2011. Non-parametric parametricity. J. Funct. Program. 21, 4-5 (2011), 497–562.Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Benjamin C. Pierce. 2002. Types and Programming Languages. MIT Press, Chapter 23.Google ScholarGoogle Scholar
  30. John Reynolds. 1974. Towards a Theory of Type Structure. In Proc. Colloque sur la Programmation (Lecture Notes in Computer Science), Vol. 19. Springer-Verlag, 408–425. Google ScholarGoogle ScholarCross RefCross Ref
  31. Taro Sekiyama, Atsushi Igarashi, and Michael Greenberg. 2017. Polymorphic Manifest Contracts, Revised and Resolved. ACM Trans. Program. Lang. Syst. 39, 1, Article 3 (Feb. 2017), 36 pages.Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. Jeremy G. Siek and Walid Taha. 2006. Gradual Typing for Functional Languages. In Scheme And Functional Programming Workshop. 81–92.Google ScholarGoogle Scholar
  33. Jeremy G. Siek and Walid Taha. 2007. Gradual Typing for Objects. In ECOOP 2007 - Object-Oriented Programming, 21st European Conference, Berlin, Germany, July 30 - August 3, 2007, Proceedings. 2–27. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. Jeremy G. Siek and Manish Vachharajani. 2008. Gradual typing with unification-based inference. In Proceedings of the 2008 Symposium on Dynamic Languages, DLS 2008, July 8, 2008, Paphos, Cyprus. 7. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. Jeremy G. Siek, Michael M. Vitousek, Matteo Cimini, and John Tang Boyland. 2015. Refined Criteria for Gradual Typing. In 1st Summit on Advances in Programming Languages, SNAPL 2015, May 3-6, 2015, Asilomar, California, USA. 274–293. Google ScholarGoogle ScholarCross RefCross Ref
  36. Jeremy G. Siek and Philip Wadler. 2010. Threesomes, with and without blame. In Proceedings of the 37th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2010, Madrid, Spain, January 17-23, 2010. 365–376. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. Jeremy G. Siek and Philip Wadler. 2016. The key to blame: Gradual typing meets cryptography. (2016).Google ScholarGoogle Scholar
  38. Satish Thatte. 1990. Quasi-static Typing. In Proceedings of the 17th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 1990. 367–381. Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. Sam Tobin-Hochstadt and Matthias Felleisen. 2006. Interlanguage migration: from scripts to programs. In Companion to the 21th Annual ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications, OOPSLA 2006, October 22-26, 2006, Portland, Oregon, USA. 964–974. Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. Sam Tobin-Hochstadt and Matthias Felleisen. 2008. The design and implementation of typed scheme. In Proceedings of the 35th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2008, San Francisco, California, USA, January 7-12, 2008. 395–406. Google ScholarGoogle ScholarDigital LibraryDigital Library
  41. Michael M. Vitousek, Andrew M. Kent, Jeremy G. Siek, and Jim Baker. 2014. Design and Evaluation of Gradual Typing for Python. In Dynamic Language Symposium. 45–56. Google ScholarGoogle ScholarDigital LibraryDigital Library
  42. Philip Wadler. 2015. A Complement to Blame. In 1st Summit on Advances in Programming Languages, SNAPL 2015, May 3-6, 2015, Asilomar, California, USA. 309–320.Google ScholarGoogle Scholar
  43. Philip Wadler and Robert Bruce Findler. 2009. Well-Typed Programs Can’t Be Blamed. In Programming Languages and Systems, 18th European Symposium on Programming, ESOP 2009, Held as Part of the Joint European Conferences on Theory and Practice of Software, ETAPS 2009, York, UK, March 22-29, 2009. Proceedings. 1–16. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. On polymorphic gradual typing

        Recommendations

        Comments

        Login options

        Check if you have access through your login credentials or your institution to get full access on this article.

        Sign in

        Full Access

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader