What's in the Box: Ergonomic and Expressive Capture Tracking over Generic Data Structures
Yichen Xu, Oliver Bracevac, Cao Nguyen Pham, Martin Odersky
摘要
Capturing types in Scala unify static effect and resource tracking with object capabilities, enabling lightweight effect polymorphism with minimal notational overhead. However, their expressiveness has been insufficient for tracking capabilities embedded in generic data structures, preventing them from scaling to the standard collections library -an essential prerequisite for broader adoption. This limitation stems from the inability to name capabilities within the system's notion of box types.
This paper develops System Capless, a new foundation for capturing types that provides the theoretical basis for reach capabilities (rcaps), a novel mechanism for naming "what's in the box". The calculus refines the universal capability notion into a new scheme with existential and universal capture set quantification. Intuitively, rcaps witness existentially quantified capture sets inside the boxes of generic types in a way that does not require exposing existential capture types in the surface language. We have fully mechanized the formal metatheory of System Capless in Lean, including proofs of type soundness and scope safety. System Capless supports the same lightweight notation of capturing types plus rcaps, as certified by a type-preserving translation, and also enables fully optional explicit capture-set quantification to increase expressiveness.
Finally, we present a full reimplementation of capture checking in Scala 3 based on System Capless and migrate the entire Scala collections library and an asynchronous programming library to evaluate its practicality and ergonomics. Our results demonstrate that reach capabilities enable the adoption of capture checking in production code with minimal changes and minimal-to-zero notational overhead in a vast majority of cases.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 6 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- Tracking Borrows with Regular Expressions 引用了 Reachability types: tracking aliasing and separation in higher-order functional programs
- Graph IRs for Impure Higher-Order Languages: Making Aggressive Optimizations Affordable with Precise Effect Dependencies 引用了 Reachability types: tracking aliasing and separation in higher-order functional programs
- Typestate via Revocable Capabilities 引用了 Graph IRs for Impure Higher-Order Languages: Making Aggressive Optimizations Affordable with Precise Effect Dependencies
- Typestate via Revocable Capabilities 引用了 Effects, capabilities, and boxes: from scope-based reasoning to type-based reasoning and back
- Typestate via Revocable Capabilities 引用了 Reachability types: tracking aliasing and separation in higher-order functional programs
- Typestate via Revocable Capabilities 引用了 Escape with Your Self: Sound and Expressive Bidirectional Typing with Avoidance for Reachability Types
- Effects, capabilities, and boxes: from scope-based reasoning to type-based reasoning and back 引用了 Effects as capabilities: effect handlers and lightweight effect polymorphism
- Classifying Capabilities 引用了 Effects as capabilities: effect handlers and lightweight effect polymorphism
- Classifying Capabilities 引用了 Rows and Capabilities as Modal Effects
- Reachability types: tracking aliasing and separation in higher-order functional programs 引用了 Effects as capabilities: effect handlers and lightweight effect polymorphism
- Rows and Capabilities as Modal Effects 引用了 Effects, capabilities, and boxes: from scope-based reasoning to type-based reasoning and back
- Rows and Capabilities as Modal Effects 引用了 Effects as capabilities: effect handlers and lightweight effect polymorphism
- Escape with Your Self: Sound and Expressive Bidirectional Typing with Avoidance for Reachability Types 引用了 Reachability types: tracking aliasing and separation in higher-order functional programs
- Reference Capabilities for Flexible Memory Management 引用了 Effects, capabilities, and boxes: from scope-based reasoning to type-based reasoning and back
引用它的顶会 Paper6
- Rows and Capabilities as Modal EffectsWenhao Tang, Sam LindleyPOPL 2026 · 1 次引用
- Escape with Your Self: Sound and Expressive Bidirectional Typing with Avoidance for Reachability TypesSonglin Jia, Guannan Wei, Siyuan He, Yuyan Bao 等PLDI 2026 · 1 次引用
- Tracking Borrows with Regular ExpressionsTodd Nowacki, Sam Blackshear, John Mitchell, Shaz Qadeer 等OOPSLA 2026
- Typestate via Revocable CapabilitiesSonglin Jia, Craig Liu, Siyuan He, Haotian Deng 等PLDI 2026
- Classifying CapabilitiesCao Nguyen Pham, Oliver Bračevac, Yichen Xu, Yaoyu Zhao 等OOPSLA 2026
它引用的 Paper10
- Effects as capabilities: effect handlers and lightweight effect polymorphismJonathan Immanuel Brachthäuser, Philipp Schuster, Klaus OstermannOOPSLA 2020 · 62 次引用
- 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 次引用
- Reachability types: tracking aliasing and separation in higher-order functional programsYuyan Bao, Guannan Wei, Oliver Bracevac, Yuxuan Jiang 等OOPSLA 2021 · 19 次引用
- Reference Capabilities for Flexible Memory ManagementEllen Arvidsson, Elias Castegren, Sylvan Clebsch, Sophia Drossopoulou 等OOPSLA 2023 · 17 次引用
- Graph IRs for Impure Higher-Order Languages: Making Aggressive Optimizations Affordable with Precise Effect DependenciesOliver Bracevac, Guannan Wei, Songlin Jia, Supun Abeysinghe 等OOPSLA 2023 · 14 次引用
相关 Paper
- Polymorphic Reachability Types: Tracking Freshness, Aliasing, and Separation in Higher-Order Generic ProgramsGuannan Wei, Oliver Bracevac, Songlin Jia, Yuyan Bao 等POPL 2024 · 12 次引用
- Qualifying System F<: Some Terms and Conditions May ApplyEdward Lee, Yaoyu Zhao, Ondrej Lhoták, James You 等OOPSLA 2024 · 2 次引用
- Complete the Cycle: Reachability Types with Expressive Cyclic ReferencesHaotian Deng, Siyuan He, Songlin Jia, Yuyan Bao 等OOPSLA 2025 · 3 次引用
- Degrees of Separation: A Flexible Type System for Safe ConcurrencyYichen Xu, Aleksander Boruch-Gruszecki, Martin OderskyOOPSLA 2024 · 6 次引用
- Type-level programming with match typesOlivier Blanvillain, Jonathan Immanuel Brachthäuser, Maxime Kjaer, Martin OderskyPOPL 2022 · 10 次引用
