PulseExploreJournal ClubDebatesTrendingResearchersJournals
Instagram
HomeExploreJournal ClubTrending
Synapse
⌘+K
Synapse
April 12, 2026Proceedings of the ACM on Programming Languages0 citationsOpen Access

When Lifetimes Liberate: A Type System for Arenas with Higher-Order Reachability Tracking

View Full Paper
SHSiyuan HeSJSonglin JiaYBYuyan Bao

Key Points

  • The aim is to develop a type system that uniformly manages heap-allocated resources while ensuring static safety in higher-order languages.
  • Proposed a type system for managing resources under various lifetime and sharing settings.
  • Introduced three modes of resource allocation: first-class and second-class resources and coallocation by shadow arenas.
  • Formalized mechanisms using A <: and { A } <: type systems, proven to be type safe and memory safe.
  • Implemented a system that tracks both individual and grouped resources effectively.
  • Allowed for cyclic store structures and flexible sharing patterns.
  • Maintained generic abstraction across diverse allocation modes.

Abstract

Statically enforcing safe resource management is challenging due to tensions between flexible lifetime disciplines and expressive sharing patterns. Region-based systems offer lexically scoped regions under a stack discipline, wherein resources are managed in bulk. In many such systems, however, resources are second-class and can neither escape their scope nor be freely returned from functions. Ownership and linear type systems, such as Rust, offer first-class, non-lexical lifetimes with robust static guarantees, but rely on invariants that limit higher-order patterns and expressive sharing. In this work, we propose a type system that uniformly treats all heap-allocated resources under diverse lifetime, granularity, and sharing settings. Our system provides programmers with three allocation modes: (1) fresh allocation for first-class, non-lexical resources; (2) fresh allocation for second-class resources with lexically bounded lifetimes; and (3) coallocation that groups resources by shadow arenas for bulk tracking and deallocation. Regardless of mode, resources are represented uniformly at the type level, supporting generic abstraction and preserving the higher-order parametric nature of the language. Obtaining static safety in higher-order languages with flexible sharing is nontrivial. To address this, our solution builds on reachability types, and our extension adds the capability to track both individual and grouped resources, enables the expression of cyclic store structures, and allows the selective enforcing of stack lifetime discipline. These mechanisms are formalized in the A <: and A <: type systems, which are proven type safe and memory safe in Rocq.

Ask AI
Helpful
Bookmark
Share
View Full Paper

Cite This Study

He et al. (2026) studied this question.

synapsesocial.com/papers/69db37404fe01fead37c535dhttps://doi.org/10.1145/3798254
Ask AI
Helpful
Bookmark
Share
View Full Paper