一句话:提出多态可达性类型系统,用新鲜性限定符与轻量/有界多态健全跟踪高阶泛型程序中的生命周期、别名与分离。
Rust 的成功促使许多语言在类型系统中加入子结构特征,以跟踪生命周期和共享;但将相关技术迁移到需与函数式及类型级抽象交互的高阶语言并不容易。已有 reachability types 可扩展到高阶单态场景,然而在 λ* 上朴素加入类型多态或精确可达性多态会导致不可靠。本文重新设计可达性跟踪,引入 freshness qualifier 表示求值中可达集可能增长的变量,并只跟踪单步可达变量、必要时再计算传递闭包,从而保留可由替换精化的已知变量可达链。基于此提出 λ◆-演算(精确的轻量、无量词可达性多态)与 F<:◆-演算(对类型和可达性限定符的有界参数多态),在 Coq 中证明类型可靠性与分离保持性,并讨论安全能力编程、效应系统扩展及与 Scala capture types 的比较。
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. 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. However, naive extensions on top of the prior reachability type system λ * 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 new polymorphic reachability type systems. We introduce a new freshness qualifier to indicate variables whose reachability sets may grow during evaluation steps. The new system tracks variables reachable in a single step and computes transitive closures only when necessary, thus preserving chains of reachability over known variables that can be refined using substitution. 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, paving the way for making true tracking of lifetimes and sharing practical for mainstream languages. We prove type soundness and the preservation of separation property in Coq. We discuss various applications ( e.g. , safe capability programming), possible effect system extensions, and compare our system with Scala’s capture types.
@article{paperbot2590,
title = {Polymorphic Reachability Types: Tracking Freshness, Aliasing, and Separation in Higher-Order Generic Programs},
author = {Guannan Wei and Oliver Bračevac and Songlin Jia and Yuyan Bao and Tiark Rompf},
journal = {Proceedings of the ACM on Programming Languages},
volume = {8},
number = {POPL},
year = {2024},
doi = {10.1145/3632856}
}