Graduality and parametricity: together again for the first time
Max S. New, Dustin Jamner, Amal Ahmed
Abstract
Parametric polymorphism and gradual typing have proven to be a difficult combination, with no language yet produced that satisfies the fundamental theorems of each: parametricity and graduality. Notably, Toro, Labrada, and Tanter (POPL 2019) conjecture that for any gradual extension of System F that uses dynamic type generation, graduality and parametricity are ``simply incompatible''. However, we argue that it is not graduality and parametricity that are incompatible per se, but instead that combining the syntax of System F with dynamic type generation as in previous work necessitates type-directed computation, which we show has been a common source of graduality and parametricity violations in previous work. We then show that by modifying the syntax of universal and existential types to make the type name generation explicit, we remove the need for type-directed computation, and get a language that satisfies both graduality and parametricity theorems. The language has a simple runtime semantics, which can be explained by translation to a statically typed language where the dynamic type is interpreted as a dynamically extensible sum type. Far from being in conflict, we show that the parametricity theorem follows as a direct corollary of a relational interpretation of the graduality property.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext 5e539aa4-9a74-493f-aaea-8dd49e857738Cited by top-tier papers10
- Semantic soundness for language interoperabilityDaniel Patterson, Noble Mushtak, Andrew Wagner, Amal AhmedPLDI 2022 · 21 citations
- Fully abstract from static to gradualKoen Jacobs, Amin Timany, Dominique DevriesePOPL 2021 · 14 citations
- Abstracting gradual typing moving forward: precise and space-efficientFelipe Bañados Schwerter, Alison M. Clark, Khurram A. Jafery, Ronald GarciaPOPL 2021 · 13 citations
- Reconciling noninterference and gradual typingArthur Azevedo de Amorim, Matt Fredrikson, Limin JiaLICS 2020 · 12 citations
- Gradually structured dataStefan Malewski, Michael Greenberg, Éric TanterOOPSLA 2021 · 4 citations
Related papers
- Plausible sealing for gradual parametricityElizabeth Labrada, Matías Toro, Éric Tanter, Dominique DevrieseOOPSLA 2022 · 7 citations
- Denotational Semantics of Gradual Typing using Synthetic Guarded Domain TheoryEric Giovannini, Tingting Ding, Max S. NewPOPL 2025 · 2 citations
- Merging Gradual TypingWenjia Ye, Bruno C. d. S. Oliveira, Matías ToroOOPSLA 2024 · 2 citations
- Gradually Typed Languages Should Be Vigilant!Olek Gierczak, Lucy Menon, Christos Dimoulas, Amal AhmedOOPSLA 2024 · 1 citation
- Space-Efficient Polymorphic Gradual Typing, Mostly ParametricAtsushi Igarashi, Shota Ozaki, Taro Sekiyama, Yudai TanabePLDI 2024 · 2 citations
