The paper introduces reachability types, a type system that tracks the reachable resources of an expression to enable more expressive programming patterns compared to Rust's "shared XOR mutable" model. The key challenge in realizing reachability types is the design of a sound and expressive subtyping relation for self-references, which are used to track escaped data.
The authors first present the 휆q
푅-calculus, which refines the previous 휆q calculus with a more expressive subtyping relation for types and qualifiers. The subtyping rules combine information about types and qualifiers, and introduce the concept of "qualifier growth" to enable sound and flexible subtyping involving self-references.
The authors then develop a sound and decidable bidirectional type checking algorithm for 휆q
푅. The algorithm includes three key components: a qualifier subsumption algorithm, a subtyping algorithm, and a top-level bidirectional typing algorithm that switches between checking and inference modes, including a hybrid mode that checks against an expected type while synthesizing a qualifier.
The paper also discusses the expressiveness of 휆q
푅 by presenting encodings of Church-encoded data structures, demonstrating that the refined calculus and type checking algorithm can handle higher-order programs involving escaping data structures more smoothly than prior work.
На другой язык
из исходного контента
arxiv.org
Дополнительные вопросы