Escape with Your Self: A Solution to the Avoidance Problem with Decidable Bidirectional Typing for Reachability Types

📅 2024-04-12
📈 Citations: 2
Influential: 0
📄 PDF
🤖 AI Summary
This work addresses the “escape problem” (variable scope leakage) in reachability-based type systems under subtyping. Existing approaches rely on self-references and function qualifiers, requiring manual term-level coercions—e.g., η-expansions—that impair algorithmic practicality. We propose a refined reachability type system based on self-references, supporting precise static tracking of shared, escaping, and mutable data in higher-order, polymorphic programs under Rust-style ownership semantics. We introduce a novel refined subtyping relation that eliminates all term-level coercions. Furthermore, we present the first sound and decidable bidirectional type-checking algorithm for such systems and formally verify it in Coq. Our results yield a fully decidable, zero-runtime-overhead static reachability inference mechanism, enabling practical lifetime safety guarantees for higher-order languages.

Technology Category

Application Category

📝 Abstract
Despite Rust's success in system programming, its ``shared XOR mutable'' principle significantly restricts how mutable values can be used, precluding many useful functional programming idioms. Reachability types are a recent proposal to address the key limitations of Rust-style approaches by tracking, rather than prohibiting, shared, escaping, and mutable data, even in the presence of higher-order functions and polymorphic types. The key to enabling tracking in the presence of avoidance is their notion of self-references. Similar to this pointers in OO languages, self-references expose the reachability of enclosing objects to internal components. While they help track escaped data, they present major challenges in designing expressive subtyping and decidable typing algorithms, as they involve subtle interactions with bounds and variance. This lack of an effective type checking algorithm is a key impediment toward making reachability types truly practical and leveraging them to bring the benefits of programming with lifetimes to practical higher-level languages. In this paper, we investigate the issues of subtyping and type checking of self-references, to fully enable this avoidance solution. We address key gaps in previous work by proposing a refined notion of subtyping, which supports encoding datatypes without resorting to term-level coercions, making the overall system more expressive. We also develop a sound and decidable bidirectional typing algorithm, formally verified in Coq.
Problem

Research questions and friction points this paper is trying to address.

Addressing algorithmic avoidance in reachability type systems
Developing sound bidirectional typing with automatic subtyping conversion
Resolving self-reference qualifier reasoning without manual coercions
Innovation

Methods, ideas, or system contributions that make the work stand out.

Bidirectional typing system with avoidance strategy
Self-aware subtyping theory for self-references
Lightweight unification mechanism for qualifier inference
🔎 Similar Papers
No similar papers found.