Polymorphic Reachability Types: Tracking Freshness, Aliasing, and Separation in Higher-Order Generic Programs
Guannan Wei, Oliver Bracevac, Songlin Jia, Yuyan Bao, Tiark Rompf
Abstract
Fueled by the success of Rust, many programming languages are adding substructural features to their type systems. The promise of tracking properties such as lifetimes and sharing is tremendous, not just for low-level memory management, but also for controlling higher-level resources and capabilities. But so are the difficulties in adapting successful techniques from Rust to higher-level languages, where they need to interact with other advanced features, especially various flavors of functional and type-level abstraction. Hence, recent proposals such as Scala's Capture Types target far narrower domains than Rust. But what would it take to bring full-fidelity reasoning about lifetimes and sharing to mainstream languages? Reachability types are a recent proposal that has shown promise in scaling to higher-order but monomorphic settings, tracking aliasing and separation on top of a substrate inspired by separation logic. The 𝜆 * reachability type system qualifies types with sets of reachable variables and guarantees separation if two terms have disjoint qualifiers. However, naive extensions with type polymorphism and/or precise reachability polymorphism are unsound, making 𝜆 * unsuitable for adoption in real languages. Combining reachability and type polymorphism that is precise, sound, and parametric remains an open challenge.
This paper presents a rethinking of the design of reachability tracking and proposes a solution to the key challenge of reachability polymorphism. Instead of always tracking the transitive closure of reachable variables as in the original design, we only track variables reachable in a single step and compute transitive closures only when necessary, thus preserving chains of reachability over known variables that can be refined using substitution. To enable this property, we introduce a new freshness qualifier, which indicates variables whose reachability sets may grow during evaluation steps. These ideas yield the simply-typed 𝜆 -calculus with precise lightweight, i.e., quantifier-free, reachability polymorphism, and the F <: -calculus with bounded parametric polymorphism over types and reachability qualifiers. We prove type soundness and a preservation of separation property in Coq. We show that our system subsumes both previous reachability type systems as well as the essence of Scala's capture types, making true tracking of lifetimes and sharing practical for mainstream languages.
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 c6ad5932-ca42-4986-807b-9f32a0ca91f3Cited by top-tier papers16
- Graph IRs for Impure Higher-Order Languages: Making Aggressive Optimizations Affordable with Precise Effect DependenciesOliver Bracevac, Guannan Wei, Songlin Jia, Supun Abeysinghe et al.OOPSLA 2023 · 14 citations
- Data Race Freedom à la ModeAïna Linn Georges, Benjamin Peters, Laila Elbeheiry, Leo White et al.POPL 2025 · 6 citations
- Degrees of Separation: A Flexible Type System for Safe ConcurrencyYichen Xu, Aleksander Boruch-Gruszecki, Martin OderskyOOPSLA 2024 · 6 citations
- Functional Ownership through Fractional UniquenessDanielle Marshall, Dominic OrchardOOPSLA 2024 · 6 citations
- A Lightweight Type-and-Effect System for Invalidation Safety: Tracking Permanent and Temporary Invalidation with Constraint-Based Subtype InferenceCunyuan Gao, Lionel ParreauxOOPSLA 2025 · 4 citations
Builds on5
- Effects as capabilities: effect handlers and lightweight effect polymorphismJonathan Immanuel Brachthäuser, Philipp Schuster, Klaus OstermannOOPSLA 2020 · 62 citations
- Mœbius: metaprogramming using contextual types: the stage where system f can pattern match on itselfJunyoung Jang, Samuel Gélineau, Stefan Monnier, Brigitte PientkaPOPL 2022 · 28 citations
- Effects, capabilities, and boxes: from scope-based reasoning to type-based reasoning and backJonathan Immanuel Brachthäuser, Philipp Schuster, Edward Lee, Aleksander Boruch-GruszeckiOOPSLA 2022 · 24 citations
- Reachability types: tracking aliasing and separation in higher-order functional programsYuyan Bao, Guannan Wei, Oliver Bracevac, Yuxuan Jiang et al.OOPSLA 2021 · 19 citations
- Graph IRs for Impure Higher-Order Languages: Making Aggressive Optimizations Affordable with Precise Effect DependenciesOliver Bracevac, Guannan Wei, Songlin Jia, Supun Abeysinghe et al.OOPSLA 2023 · 14 citations
Related papers
- Complete the Cycle: Reachability Types with Expressive Cyclic ReferencesHaotian Deng, Siyuan He, Songlin Jia, Yuyan Bao et al.OOPSLA 2025 · 3 citations
- Escape with Your Self: Sound and Expressive Bidirectional Typing with Avoidance for Reachability TypesSonglin Jia, Guannan Wei, Siyuan He, Yuyan Bao et al.PLDI 2026 · 1 citation
- What's in the Box: Ergonomic and Expressive Capture Tracking over Generic Data StructuresYichen Xu, Oliver Bracevac, Cao Nguyen Pham, Martin OderskyOOPSLA 2025 · 4 citations
- Modeling Reachability Types with Logical Relations: Semantic Type Soundness, Termination, Effect Safety, and Equational TheoryYuyan Bao, Songlin Jia, Guannan Wei, Oliver Bracevac et al.OOPSLA 2025 · 3 citations
- Qualifying System F<: Some Terms and Conditions May ApplyEdward Lee, Yaoyu Zhao, Ondrej Lhoták, James You et al.OOPSLA 2024 · 2 citations
