Reference. Linear Effects, Exceptions, and Resource Safety: A Curry-Howard Correspondence for Destructors
We analyse the problem of combining linearity, effects, and exceptions, in abstract models of programming languages, as the issue of providing some kind of strength for a monad in a linear setting. We consider in particular for T the allocation monad, which we introduce to model and study resource-safety properties. We apply these results to a series of two linear effectful calculi for which we establish their resource-safety properties. The first calculus is a linear (optionally ordered) call-by-push-value language with two allocation effects and . The resource-safety properties follow from the linear and ordered character of the typing rules. We then integrate exceptions with linearity and effects by adjoining default destruction actions to types, as inspired by C++/Rust destructors. We see destructors as objects in the slice category over . This construction gives rise to a second calculus, the resource call-by-push-value, featuring exceptions and destructors, and whose weakening and exchange rules perform side-effects. It is therefore affine at the level of types but ordered at the level of derivations. As in C++ and Rust, a “move” operation—the side-effecting exchange rule—is necessary for releasing resources in random order, as opposed to LIFO order.
Cite
Cites 58 works (3 here)
With notes (3)
Resource Polymorphism munchmaccagnoni-2018-resource
We present a resource-management model for ML-style programming languages, designed to be compatible with the OCaml philosophy and runtime model. This is a proposal to extend the OCaml language with destructors, move semantics, and resource polymorphism, to improve its safety, efficiency, interoperability, and expressiveness. It builds on the ownership-and-borrowing models of systems programming languages (Cyclone, C++11, Rust) and on linear types in functional programming (Linear Lisp, Clean, Alms). It continues a synthesis of resources from systems programming and resources in linear logic initiated by Baker. It is a combination of many known and some new ideas. On the novel side, it highlights the good mathematical structure of Stroustrup’s “Resource acquisition is initialisation” (RAII) idiom for resource management based on destructors, a notion sometimes confused with finalizers, and builds on it a notion of resource polymorphism, inspired by polarisation in proof theory, that mixes C++‘s RAII and a tracing garbage collector (GC). The proposal targets a new spot in the design space, with an automatic and predictable resource-management model, at the same time based on lightweight and expressive language abstractions. It is backwards-compatible: current code is expected to run with the same performance, the new abstractions fully combine with the current ones, and it supports a resource-polymorphic extension of libraries. It does so with only a few additions to the runtime, and it integrates with the current GC implementation. It is also compatible with the upcoming multicore extension, and suggests that the Rust model for eliminating data-races applies. Interesting questions arise for a safe and practical type system, many of which have already been thoroughly investigated in the languages and prototypes Cyclone, Rust, and Alms.
A theory of effects and resources: adjunction models and polarised calculi curien-2016-a
Linear logic girard_linear_1987
The familiar connective of negation is broken into two operations: linear negation which is the purely negative part of negation and the modality “of course” which has the meaning of a reaffirmation. Following this basic discovery, a completely new approach to the whole area between constructive logics and programmation is initiated.
External (55)
- Creusot: A Foundry for the Deductive Verification of Rust Programs (2022)
- Aeneas: Rust verification by functional translation (2022)
- Quantitative program reasoning with graded modal types (2019)
- Affine Sessions (2018)
- A resource modality for RAII (abstract) (2018)
- Linear Haskell: practical linearity in a higher-order polymorphic language (2017)
- RustBelt: securing the foundations of the Rust programming language (2017)
- Retrofitting Linear Types (in submission) (2017)
- Note on models of polarised intuitionistic logic (Tech. rep.) (2017)
- Contextual isomorphisms (2016)
- Linear Exponential Comonads without Symmetry (2016)
- Type Classes for Lightweight Substructural Types (2015)
- Linear usage of state (2014)
- Practical Programming with Substructural Types (PhD thesis) (2012)
- A theory of substructural types and control (2011)
- Practical affine types (2011)
- Substructural Operational Semantics as Ordered Logic Programming (2009)
- Categorical semantics of linear logic (Panoramas et Syntheses 27) (2009)
- A Linear-non-Linear Model for a Computational Call-by-Value Lambda Calculus (Extended Abstract) (2008)
- Linear Regions Are All You Need (2006)
- Safe manual memory management in Cyclone (2006)
- Semantics of Linear Continuation-Passing in Call-by-Name (2004)
- Substructural Type Systems (2004)
- Call-By-Push-Value: A Functional/Imperative Synthesis (2004)
- From subfactors to categories and topology II: The quantum double of tensor categories and subfactors (2003)
- Region-based memory management in cyclone (2002)
- Linearly Used Effects: Monadic and CPS Transformations into the Linear Lambda Calculus (2002)
- Notions of Computation Determine Monads (2002)
- Premonoidal categories as categories with algebraic structure (2002)
- A Proposal to Add Move Semantics Support to the C++ Language (2002)
- Exceptional syntax (2001)
- Proving Syntactic Properties of Exceptions in an Ordered Logical Framework (2001)
- Linearly used continuations (2001)
- Ordered Linear Logic and Applications (PhD thesis) (2001)
- A Type System for Bounded Space and Functional In-Place Update (2000)
- Direct Models of the Computational Lambda-calculus (1999)
- Call-by-Push-Value: A Subsuming Paradigm (1999)
- Premonoidal categories and notions of computation (1997)
- Region-Based Memory Management (1997)
- ! and ? – Storage as tensorial strength (1996)
- “Use-once” variables and linear objects (1995)
- Call-by-name, Call-by-value, Call-by-need, and the Linear Lambda Calculus (1995)
- Linear logic and permutation stacks—the Forth shall be first (1994)
- A model of intuitionistic affine logic from stable domain theory (1994)
- Representing monads (1994)
- A history of C++ (1993)
- Lively linear Lisp (1992)
- Linear continuations (1992)
- Notions of computation and monads (1991)
- Exception Handling for C++ (1990)
- Computational lambda-calculus and monads (1989)
- The linear abstract machine (1988)
- On closed categories of functors (1970)
- Categorical models of linear logic revisited (preprint)
- Parametric monads and enriched adjunctions (draft)