Deep and shallow types for gradual languages
Ben Greenman
Abstract
Sound gradual types come in many forms and offer varying levels of soundness. Two extremes are deep types and shallow types. Deep types offer compositional guarantees but depend on expensive higher-order contracts. Shallow types enforce only local properties, but can be implemented with first-order checks. This paper presents a language design that supports both deep and shallow types to utilize their complementary strengths.
In the mixed language, deep types satisfy a strong complete monitoring guarantee and shallow types satisfy a firstorder notion of type soundness. The design serves as the blueprint for an implementation in which programmers can easily switch between deep and shallow to leverage their distinct advantages. On the GTP benchmark suite, the median worst-case overhead drops from several orders of magnitude down to 3x relative to untyped. Where an exhaustive search is feasible, 40% of all configurations run fastest with a mix of deep and shallow types.
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 fdc4373c-5f78-4a50-af43-869d14e386b2Cited by top-tier papers2
- Denotational Semantics of Gradual Typing using Synthetic Guarded Domain TheoryEric Giovannini, Tingting Ding, Max S. NewPOPL 2025 · 2 citations
- Gradually Typed Languages Should Be Vigilant!Olek Gierczak, Lucy Menon, Christos Dimoulas, Amal AhmedOOPSLA 2024 · 1 citation
Builds on2
Related papers
- Abstracting gradual typing moving forward: precise and space-efficientFelipe Bañados Schwerter, Alison M. Clark, Khurram A. Jafery, Ronald GarciaPOPL 2021 · 13 citations
- How Profilers Can Help Navigate Type MigrationBen Greenman, Matthias Felleisen, Christos DimoulasOOPSLA 2023 · 1 citation
- Merging Gradual TypingWenjia Ye, Bruno C. d. S. Oliveira, Matías ToroOOPSLA 2024 · 2 citations
- Fully abstract from static to gradualKoen Jacobs, Amin Timany, Dominique DevriesePOPL 2021 · 14 citations
- Type-Based Gradual Typing Performance OptimizationJohn Peter Campora III, Mohammad Wahiduzzaman Khan, Sheng ChenPOPL 2024 · 3 citations
