Lune

OOPSLA2024Top-tier venue

Law and Order for Typestate with Borrowing

Hannes Saffrich, Yuki Nishida, Peter Thiemann

Abstract

Typestate systems are notoriously complex as they require sophisticated machinery for tracking aliasing. We propose a new, transition-oriented foundation for typestate in the setting of impure functional programming. Our approach relies on ordered types for simple alias tracking and its formalization draws on work on bunched implications. Yet, we support a flexible notion of borrowing in the presence of typestate.

Our core calculus comes with a notion of resource types indexed by an ordered partial monoid that models abstract state transitions. We prove syntactic type soundness with respect to a resource-instrumented semantics. We give an algorithmic version of our type system and prove its soundness. Algorithmic typing facilitates a simple surface language that does not expose tedious details of ordered types. We implemented a typechecker for the surface language along with an interpreter for the core language.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

2 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Typestate via Revocable Capabilities cites Borrowing from Session Types
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers2

  1. Borrowing from Session TypesHannes Saffrich, Janek Spaderna, Peter Thiemann, Vasco T. VasconcelosOOPSLA 2025
  2. Typestate via Revocable CapabilitiesSonglin Jia, Craig Liu, Siyuan He, Haotian Deng et al.PLDI 2026

Builds on1

  1. Functional Ownership through Fractional UniquenessDanielle Marshall, Dominic OrchardOOPSLA 2024 · 6 citations

Related papers

  1. Resource-Aware Soundness for Big-Step SemanticsRiccardo Bianchini, Francesco Dagnino, Paola Giannini, Elena ZuccaOOPSLA 2023 · 6 citations
  2. Coeffects for sharing and mutationRiccardo Bianchini, Francesco Dagnino, Paola Giannini, Elena Zucca et al.OOPSLA 2022 · 5 citations
  3. From Linearity to BorrowingAndrew Wagner, Olek Gierczak, Brianna Marshall, John M. Li et al.OOPSLA 2025 · 1 citation
  4. Complete the Cycle: Reachability Types with Expressive Cyclic ReferencesHaotian Deng, Siyuan He, Songlin Jia, Yuyan Bao et al.OOPSLA 2025 · 3 citations
  5. Escape with Your Self: Sound and Expressive Bidirectional Typing with Avoidance for Reachability TypesSonglin Jia, Guannan Wei, Siyuan He, Yuyan Bao et al.PLDI 2026 · 1 citation
Dusk over the sea between two cliffs drawn in fine vertical lines