一句话:扩展可达类型,引入循环引用、浅层限定符跟踪与逃逸规则,提升高阶别名与可变状态表达力并机器验证类型安全。
针对高阶程序中将别名与可变状态结合时的局部推理难题,现有所有权、线性/仿射、唯一性与词法效应跟踪等方法要么施加全局限制,要么依赖浅层语法分析。可达类型(RT)能跟踪高阶别名与分离,但存在三方面局限:禁止循环引用、需深度跟踪传递可达位置、被引用限定符不变导致引用无法逃逸分配上下文。本文扩展 RT,引入循环引用、浅层限定符跟踪以及带引用子类型的逃逸规则,并在 F<:∘ 演算中形式化,机器验证类型可靠性。案例展示不动点组合子、非干扰并行和逃逸只读引用。
Local reasoning about programs that combine aliasing and mutable state is a longstanding challenge. Existing approaches – ownership systems, linear and affine types, uniqueness types, and lexical effect tracking – impose global restrictions such as uniqueness or linearity, or rely on shallow syntactic analyses. These designs fall short with higher-order functions and shared mutable state. Reachability Types (RT) track aliasing and separation in higher-order programs, ensuring runtime safety and non-interference. However, RT systems face three key limitations: (1) they prohibit cyclic references, ruling out non-terminating computations and fixed-point combinators; (2) they require deep tracking, where a qualifier must include all transitively reachable locations, reducing precision and hindering optimizations like fine-grained parallelism; and (3) referent qualifier invariance prevents referents from escaping their allocation contexts, making reference factories inexpressible. In this work, we address these limitations by extending RT with three mechanisms that enhance expressiveness. First, we introduce cyclic references, enabling recursive patterns to be encoded directly through the store. Second, we adopt shallow qualifier tracking, decoupling references from their transitively reachable values. Finally, we introduce an escaping rule with reference subtyping, allowing referent qualifiers to outlive their allocation context. These extensions are formalized in the F < : ∘ -calculus with a mechanized proof of type soundness, and case studies illustrate expressiveness through fixpoint combinators, non-interfering parallelism, and escaping read-only references.
@article{paperbot2996,
title = {Complete the Cycle: Reachability Types with Expressive Cyclic References},
author = {Haotian Deng and Siyuan He and Songlin Jia and Yuyan Bao and Tiark Rompf},
journal = {Proceedings of the ACM on Programming Languages},
volume = {9},
number = {OOPSLA2},
year = {2025},
doi = {10.1145/3763172}
}