skip to main content
research-article

Gradual System F

Authors Info & Claims
Published:28 October 2022Publication History
Skip Abstract Section

Abstract

Bringing the benefits of gradual typing to a language with parametric polymorphism like System F, while preserving relational parametricity, has proven extremely challenging: first attempts were formulated a decade ago, and several designs have been recently proposed, with varying syntax, behavior, and properties. Starting from a detailed review of the challenges and tensions that affect the design of gradual parametric languages, this work presents an extensive account of the semantics and metatheory of GSF, a gradual counterpart of System F. In doing so, we also report on the extent to which the Abstracting Gradual Typing methodology can help us derive such a language. Among gradual parametric languages that follow the syntax of System F, GSF achieves a unique combination of properties. We clearly establish the benefits and limitations of the language, and discuss several extensions of GSF towards a practical programming language.

REFERENCES

  1. Abadi Martin, Cardelli Luca, Pierce Benjamin, and Plotkin Gordon. 1991. Dynamic typing in a statically typed language. ACM Transactions on Programming Languages and Systems 13, 2 (April 1991), 237268.Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Abadi Martin, Cardelli Luca, Pierce Benjamin, and Rémy Didier. 1995. Dynamic typing in polymorphic languages. Journal of Functional Programming 5, 1 (1995), 111130.Google ScholarGoogle ScholarCross RefCross Ref
  3. Ahmed Amal. 2006. Step-indexed syntactic logical relations for recursive and quantified types. In Proceedings of the 15th European Symposium on Programming Languages and Systems (ESOP 2006) (Lecture Notes in Computer Science), Sestoft Peter (Ed.), Vol. 3924. Springer-Verlag, Vienna, Austria, 6983.Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Ahmed Amal, Dreyer Derek, and Rossberg Andreas. 2009a. State-dependent representation independence. In Proceedings of the 36th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL 2009). ACM Press, Savannah, GA, USA, 340353.Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Ahmed Amal, Findler Robert Bruce, Matthews Jacob, and Wadler Philip. 2009b. Blame for all. In Workshop on Script to Program Evolution (STOP). Genova, Italy.Google ScholarGoogle Scholar
  6. Ahmed Amal, Findler Robert Bruce, Siek Jeremy G., and Wadler Philip. 2011. Blame for all. In Proceedings of the 38th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL 2011). ACM Press, Austin, Texas, USA, 201214.Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Ahmed Amal, Jamner Dustin, Siek Jeremy G., and Wadler Philip. 2017. Theorems for free for free: Parametricity, with and without types. See ICFP 2017 [2017], 39:1–39:28.Google ScholarGoogle Scholar
  8. Amorim Arthur Azevedo de, Fredrikson Matt, and Jia Limin. 2020. Reconciling noninterference and gradual typing. In Proceedings of the 2020 Symposium on Logic in Computer Science (LICS 2020).Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Bader Johannes, Aldrich Jonathan, and Tanter Éric. 2018. Gradual program verification. In Proceedings of the 19th International Conference on Verification, Model Checking, and Abstract Interpretation (VMCAI 2018) (Lecture Notes in Computer Science), Dillig Işil and Palsberg Jens (Eds.), Vol. 10747. Springer-Verlag, Los Angeles, CA, USA, 2546.Google ScholarGoogle ScholarCross RefCross Ref
  10. Schwerter Felipe Bañados, Garcia Ronald, and Tanter Éric. 2014. A theory of gradual effect systems. In Proceedings of the 19th ACM SIGPLAN Conference on Functional Programming (ICFP 2014). ACM Press, Gothenburg, Sweden, 283295.Google ScholarGoogle Scholar
  11. Schwerter Felipe Bañados, Garcia Ronald, and Tanter Éric. 2016. Gradual type-and-effect systems. Journal of Functional Programming 26 (Sept. 2016), 19:1–19:69.Google ScholarGoogle Scholar
  12. Bierman Gavin, Meijer Erik, and Torgersen Mads. 2010. Adding dynamic types to C\( ^{\#} \). In Proceedings of the 24th European Conference on Object-oriented Programming (ECOOP 2010) (Lecture Notes in Computer Science), D’Hondt Theo (Ed.). Springer-Verlag, Maribor, Slovenia, 76100.Google ScholarGoogle Scholar
  13. Bodík Rastislav and Majumdar Rupak (Eds.). 2016. Proceedings of the 43rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL 2016). ACM Press, St. Petersburg, FL, USA.Google ScholarGoogle Scholar
  14. Cartwright Robert and Fagan Mike. 1991. Soft typing. In Proceedings of the ACM SIGPLAN International Conference on Programming Language Design and Implementation (PLDI). Toronto, Ontario, Canada, 278292.Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Castagna Giuseppe and Lanvin Victor. 2017. Gradual typing with union and intersection types. See ICFP 2017 [2017], 41:1–41:28.Google ScholarGoogle Scholar
  16. Cimini Matteo and Siek Jeremy. 2016. The gradualizer: A methodology and algorithm for generating gradual type systems, See Bodík and Majumdar [2016], 443455.Google ScholarGoogle Scholar
  17. Curry Haskell B., Hindley J. Roger, and Seldin J. P.. 1972. Combinatory Logic, Volume II. Studies in logic and the foundations of mathematics, Vol. 65. North-Holland Pub. Co.Google ScholarGoogle Scholar
  18. Damas Luis and Milner Robin. 1982. Principal type-schemes for functional programs. In Proceedings of the 9th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL 1982). ACM Press, New York, NY, USA, 207212. DOI:Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Devriese Dominique, Patrignani Marco, and Piessens Frank. 2018. Parametricity versus the universal type. Proceedings of the ACM on Programming Languages 2, POPL (Jan. 2018), 38:1–38:23.Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Disney Tim and Flanagan Cormac. 2011. Gradual information flow typing. In International Workshop on Scripts to Programs.Google ScholarGoogle Scholar
  21. Eremondi Joseph, Tanter Éric, and Garcia Ronald. 2019. Approximate normalization for gradual dependent types. Proceedings of the ACM on Programming Languages 3, ICFP (Aug. 2019), 88:1–88:30.Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Fennell Luminous and Thiemann Peter. 2013. Gradual security typing with references. In Proceedings of the 26th Computer Security Foundations Symposium (CSF). 224239.Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Fennell Luminous and Thiemann Peter. 2016. LJGS: Gradual security types for object-oriented languages. In Proceedings of the 30th European Conference on Object-Oriented Programming (ECOOP 2016) (Leibniz International Proceedings in Informatics (LIPIcs)), Krishnamurthi Shriram and Lerner Benjamin S. (Eds.), Vol. 56. Schloss Dagstuhl–Leibniz-Zentrum fuer Informatik, Rome, Italy, 9:1–9:26.Google ScholarGoogle Scholar
  24. Garcia Ronald, Clark Alison M., and Tanter Éric. 2016. Abstracting gradual typing. See Bodík and Majumdar [2016], 429442. See erratum https://www.cs.ubc.ca/rxg/agt-erratum.pdf.Google ScholarGoogle Scholar
  25. Garcia Ronald and Tanter Éric. 2015. Deriving a Simple Gradual Security Language. eprint arXiv:1511.01399.Google ScholarGoogle Scholar
  26. Garcia Ronald, Tanter Éric, Wolff Roger, and Aldrich Jonathan. 2014. Foundations of typestate-oriented programming. ACM Transactions on Programming Languages and Systems 36, 4, Article 12 (Oct. 2014), 12:1–12:44 pages.Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Girard Jean-Yves. 1972. Interprétation Fonctionnelle et Élimination des Coupures de l’Arithmétique d’Ordre Supérieur. Ph.D. Dissertation. Université de Paris VII, Paris, France.Google ScholarGoogle Scholar
  28. Guha Arjun, Matthews Jacob, Findler Robert Bruce, and Krishnamurthi Shriram. 2007. Relationally-parametric polymorphic contracts. In Proceedings of the ACM Dynamic Languages Symposium (DLS 2007). ACM Press, Montreal, Canada, 2940.Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Harper Robert. 2012. Practical Foundations for Programming Languages. Cambridge University Press.Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. Herman David, Tomb Aaron, and Flanagan Cormac. 2010. Space-efficient gradual typing. Higher-Order and Symbolic Computation 23, 2 (June 2010), 167189.Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. Hou Kuen-Bang, Benton Nick, and Harper Robert. 2016. Correctness of compiling polymorphism to dynamic typing. Journal of Functional Programming 27 (2016), 1:1–1:24.Google ScholarGoogle Scholar
  32. ICFP 2017 2017.Google ScholarGoogle Scholar
  33. Igarashi Atsushi, Thiemann Peter, Vasconcelos Vasco T., and Wadler Philip. 2017b. Gradual session types. See ICFP 2017 [2017], 38:1–38:28.Google ScholarGoogle Scholar
  34. Igarashi Yuu, Sekiyama Taro, and Igarashi Atsushi. 2017a. On polymorphic gradual typing. See ICFP 2017 [2017], 40:1–40:29.Google ScholarGoogle Scholar
  35. Ina Lintaro and Igarashi Atsushi. 2011. Gradual typing for generics. In Proceedings of the 26th ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages and Applications (OOPSLA 2011). ACM Press, Portland, Oregon, USA, 609624.Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. Jacobs Koen, Timany Amin, and Devriese Dominique. 2021. Fully abstract from static to gradual. Proceedings of the ACM on Programming Languages 5, POPL (Jan. 2021), 7:1–7:30.Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. Labrada Elizabeth, Toro Matías, Tanter Éric, and Devriese Dominique. 2022. Plausible sealing for gradual parametricity. Proceedings of the ACM on Programming Languages 6, OOPSLA1 (April 2022), 70:1–70:28.Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. Lehmann Nico and Tanter Éric. 2017. Gradual refinement types. In Proceedings of the 44th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL 2017). ACM Press, Paris, France, 775788.Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. Leroy Xavier and Mauny Michel. 1991. Dynamics in ML. In Proceedings of the Conference on Functional Programming Languages and Computer Architecture (FPCA 1991) (Lecture Notes in Computer Science), Vol. 523. Springer-Verlag, 406426.Google ScholarGoogle ScholarCross RefCross Ref
  40. Levy Paul Blain. 1999. Call-by-push-value: A subsuming paradigm. In 4th International Conference on Typed Lambda Calculi and Applications (TLCA’99) (Lecture Notes in Computer Science), Girard Jean-Yves (Ed.), Vol. 1581. Springer-Verlag, 228242.Google ScholarGoogle ScholarCross RefCross Ref
  41. Matthews Jacob and Ahmed Amal. 2008. Parametric polymorphism through run-time sealing, or, theorems for low, low prices!. In Proceedings of the 17th European Symposium on Programming Languages and Systems (ESOP 2008) (Lecture Notes in Computer Science), Drossopoulou Sophia (Ed.), Vol. 4960. Springer-Verlag, Budapest, Hungary, 1631.Google ScholarGoogle ScholarCross RefCross Ref
  42. Matthews Jacob and Findler Robert Bruce. 2007. Operational semantics for multi-language programs. In Proceedings of the 34th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL 2007). ACM Press, Nice, France, 310.Google ScholarGoogle ScholarDigital LibraryDigital Library
  43. Mitchell John C.. 1988. Polymorphic type inference and containment. Information and Computation 76, 2-3 (Feb. 1988), 211249.Google ScholarGoogle ScholarDigital LibraryDigital Library
  44. Mitchell John C. and Plotkin Gordon D.. 1988. Abstract types have existential type. ACM Transactions on Programming Languages and Systems 10, 3 (July 1988), 470502. DOI:Google ScholarGoogle ScholarDigital LibraryDigital Library
  45. Morris James H.. 1973. Protection in programming languages. Commun. ACM 16, 1 (Jan. 1973), 1521.Google ScholarGoogle ScholarDigital LibraryDigital Library
  46. Neis Georg, Dryer Derek, and Rossberg Andreas. 2009. Non-parametric parametricity. In Proceedings of the 14th ACM SIGPLAN Conference on Functional Programming (ICFP 2009). ACM Press, Edinburgh, Scotland, UK, 135148.Google ScholarGoogle ScholarDigital LibraryDigital Library
  47. New Max S. and Ahmed Amal. 2018. Graduality from Embedding-Projection Pairs. 73:1–73:30 pages.Google ScholarGoogle Scholar
  48. New Max S., Jamner Dustin, and Ahmed Amal. 2020. Graduality and parametricity: Together again for the first time. Proceedings of the ACM on Programming Languages 4, POPL (Jan. 2020), 46:1–46:32.Google ScholarGoogle ScholarDigital LibraryDigital Library
  49. Odersky Martin and Läufer Konstantin. 1996. Putting type annotations to work. In Proceedings of the 23rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL 96). ACM Press, St. Petersburg Beach, Florida, USA, 5467.Google ScholarGoogle ScholarDigital LibraryDigital Library
  50. Oxford. 2021. Oxford Advanced Learner’s Dictionary (10th ed.). Oxford University Press. Evidence.Google ScholarGoogle Scholar
  51. Pierce Benjamin and Sumii Eijiro. 2000. Relating Cryptography and Polymorphism. Manuscript.Google ScholarGoogle Scholar
  52. Pierce Benjamin C.. 2002. Types and Programming Languages. MIT Press, Cambridge, MA, USA.Google ScholarGoogle ScholarDigital LibraryDigital Library
  53. Rastogi Aseem, Chaudhuri Avik, and Hosmer Basil. 2012. The ins and outs of gradual type inference. In Proceedings of the 39th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL 2012). ACM Press, Philadelphia, USA, 481494.Google ScholarGoogle ScholarDigital LibraryDigital Library
  54. Reynolds John C.. 1974. Towards a theory of type structure. In Proceedings of the Programming Symposium (Lecture Notes in Computer Science), Vol. 19. Springer-Verlag, 408423.Google ScholarGoogle ScholarCross RefCross Ref
  55. Reynolds John C.. 1983. Types, abstraction, and parametric polymorphism. In Information Processing 83, Mason R. E. A. (Ed.). Elsevier, 513523.Google ScholarGoogle Scholar
  56. Rossberg Andreas. 2003. Generativity and dynamic opacity for abstract types. In Proceedings of the 5th ACM SIGPLAN Conference on Principles and Practice of Declarative Programming (PPDP 2003). 241252.Google ScholarGoogle ScholarDigital LibraryDigital Library
  57. Sergey Ilya and Clarke Dave. 2012. Gradual ownership types. In Proceedings of the 21st European Symposium on Programming Languages and Systems (ESOP 2012) (Lecture Notes in Computer Science), Seidl Helmut (Ed.), Vol. 7211. Springer-Verlag, Tallinn, Estonia, 579599.Google ScholarGoogle ScholarDigital LibraryDigital Library
  58. Siek Jeremy and Taha Walid. 2006. Gradual typing for functional languages. In Proceedings of the Scheme and Functional Programming Workshop. 8192.Google ScholarGoogle Scholar
  59. Siek Jeremy and Taha Walid. 2007. Gradual typing for objects. In Proceedings of the 21st European Conference on Object-oriented Programming (ECOOP 2007) (Lecture Notes in Computer Science), Ernst Erik (Ed.). Springer-Verlag, Berlin, Germany, 227.Google ScholarGoogle ScholarDigital LibraryDigital Library
  60. Siek Jeremy and Wadler Philip. 2010. Threesomes, with and without blame. In Proceedings of the 37th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL 2010). ACM Press, Madrid, Spain, 365376.Google ScholarGoogle ScholarDigital LibraryDigital Library
  61. Siek Jeremy G., Vitousek Michael M., Cimini Matteo, and Boyland John Tang. 2015a. Refined criteria for gradual typing. In 1st Summit on Advances in Programming Languages (SNAPL 2015) (Leibniz International Proceedings in Informatics (LIPIcs)), Vol. 32. Schloss Dagstuhl–Leibniz-Zentrum fuer Informatik, Asilomar, California, USA, 274293.Google ScholarGoogle Scholar
  62. Siek Jeremy G., Vitousek Michael M., Cimini Matteo, Tobin-Hochstadt Sam, and Garcia Ronald. 2015b. Monotonic references for efficient gradual typing. In Proceedings of the 24th European Symposium on Programming Languages and Systems (ESOP 2015) (Lecture Notes in Computer Science), Vitek Jan (Ed.), Vol. 9032. Springer-Verlag, London, UK, 432456.Google ScholarGoogle ScholarDigital LibraryDigital Library
  63. Siek Jeremy G. and Wadler Philip. 2016. The Key to Blame: Gradual Typing Meets Cryptography. Unpublished manuscript.Google ScholarGoogle Scholar
  64. Sumii Eijiro and Pierce Benjamin C.. 2004. A bisimulation for dynamic sealing. In Proceedings of the 31st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL 2005). ACM Press, Venice, Italy, 161172.Google ScholarGoogle ScholarDigital LibraryDigital Library
  65. Tobin-Hochstadt Sam and Felleisen Matthias. 2006. Interlanguage migration: From scripts to programs. In Proceedings of the ACM Dynamic Languages Symposium (DLS 2006). ACM Press, Portland, Oregon, USA, 964974.Google ScholarGoogle ScholarDigital LibraryDigital Library
  66. Toro Matías, Garcia Ronald, and Tanter Éric. 2018. Type-driven gradual security with references. ACM Transactions on Programming Languages and Systems 40, 4 (Nov. 2018), 16:1–16:55.Google ScholarGoogle ScholarDigital LibraryDigital Library
  67. Toro Matías, Labrada Elizabeth, and Tanter Éric. 2019. Gradual parametricity, revisited. Proceedings of the ACM on Programming Languages 3, POPL (Jan. 2019), 17:1–17:30.Google ScholarGoogle ScholarDigital LibraryDigital Library
  68. Toro Matías and Tanter Éric. 2017. A gradual interpretation of union types. In Proceedings of the 24th Static Analysis Symposium (SAS 2017) (Lecture Notes in Computer Science), Vol. 10422. Springer-Verlag, New York City, NY, USA, 382404.Google ScholarGoogle ScholarCross RefCross Ref
  69. Toro Matías and Tanter Éric. 2020. Abstracting gradual references. Science of Computer Programming 197 (Oct. 2020), 165.Google ScholarGoogle ScholarCross RefCross Ref
  70. Wadler Philip. 1989. Theorems for free!. In Proceedings of the Fourth International Conference on Functional Programming Languages and Computer Architecture (FPCA’89). ACM, London, United Kingdom, 347359.Google ScholarGoogle ScholarDigital LibraryDigital Library
  71. Wadler Philip. 2017. Abstract data types without the types. Journal of Universal Computer Science 23, 1 (2017), 520.Google ScholarGoogle Scholar
  72. Wadler Philip and Findler Robert Bruce. 2009. Well-typed programs can’t be blamed. In Proceedings of the 18th European Symposium on Programming Languages and Systems (ESOP 2009) (Lecture Notes in Computer Science), Castagna Giuseppe (Ed.), Vol. 5502. Springer-Verlag, York, UK, 116.Google ScholarGoogle ScholarDigital LibraryDigital Library
  73. Wise Jenna, Bader Johannes, Wong Cameron, Aldrich Jonathan, Tanter Éric, and Sunshine Joshua. 2020. Gradual verification of recursive heap data structures. Proceedings of the ACM on Programming Languages 4, OOPSLA (Nov. 2020), 228:1–228:28.Google ScholarGoogle ScholarDigital LibraryDigital Library
  74. Wolff Roger, Garcia Ronald, Tanter Éric, and Aldrich Jonathan. 2011. Gradual typestate. In Proceedings of the 25th European Conference on Object-oriented Programming (ECOOP 2011) (Lecture Notes in Computer Science), Mezini Mira (Ed.), Vol. 6813. Springer-Verlag, Lancaster, UK, 459483.Google ScholarGoogle ScholarCross RefCross Ref
  75. Xie Ningning, Bi Xuan, and Oliveira Bruno C. d. S.. 2018. Consistent subtyping for all. In Proceedings of the 27th European Symposium on Programming Languages and Systems (ESOP 2018) (Lecture Notes in Computer Science), Ahmed Amal (Ed.), Vol. 10801. Springer-Verlag, Thessaloniki, Greece, 330.Google ScholarGoogle ScholarCross RefCross Ref

Index Terms

  1. Gradual System F

      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

      • Published in

        cover image Journal of the ACM
        Journal of the ACM  Volume 69, Issue 5
        October 2022
        420 pages
        ISSN:0004-5411
        EISSN:1557-735X
        DOI:10.1145/3563903
        Issue’s Table of Contents

        Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected].

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 28 October 2022
        • Online AM: 10 August 2022
        • Accepted: 22 June 2022
        • Revised: 8 June 2022
        • Received: 28 May 2020
        Published in jacm Volume 69, Issue 5

        Permissions

        Request permissions about this article.

        Request Permissions

        Check for updates

        Qualifiers

        • research-article
        • Refereed
      • Article Metrics

        • Downloads (Last 12 months)62
        • Downloads (Last 6 weeks)3

        Other Metrics

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader

      Full Text

      View this article in Full Text.

      View Full Text

      HTML Format

      View this article in HTML Format .

      View HTML Format