Destination Calculus: A Linear {lambda}-Calculus for Purely Functional Memory Writes

๐Ÿ“… 2025-03-10
๐Ÿ“ˆ Citations: 0
โœจ Influential: 0
๐Ÿ“„ PDF
๐Ÿค– AI Summary
This paper addresses the fundamental challenge in purely functional programming of supporting destination passingโ€”i.e., populating results via parameters rather than return values. We present the first purely functional linear ฮป-calculus centered on destination passing, natively integrating this mechanism. Its modal type system uniformly governs linearity and scope, enabling effect-free memory writes and formally unifying diverse out-parameter systems. The calculus is fully formalized in Coq, with mechanized proofs of type safety and enhanced expressiveness: it is the first purely functional framework capable of encoding imperative programs previously inexpressible in such settings. Our work establishes a semantic foundation and a scalable theoretical framework for destination-aware functional languages.

Technology Category

Application Category

๐Ÿ“ Abstract
Destination passing -- aka. out parameters -- is taking a parameter to fill rather than returning a result from a function. Due to its apparently imperative nature, destination passing has struggled to find its way to pure functional programming. In this paper, we present a pure functional calculus with destinations at its core. Our calculus subsumes all the similar systems, and can be used to reason about their correctness or extension. In addition, our calculus can express programs that were previously not known to be expressible in a pure language. This is guaranteed by a modal type system where modes are used to manage both linearity and scopes. Type safety of our core calculus was proved formally with the Coq proof assistant.
Problem

Research questions and friction points this paper is trying to address.

Introduces a pure functional calculus for destination passing.
Enables reasoning about correctness and extension of similar systems.
Expresses previously inexpressible programs in pure languages.
Innovation

Methods, ideas, or system contributions that make the work stand out.

Pure functional calculus with destination passing
Modal type system managing linearity and scopes
Formal type safety proof using Coq
๐Ÿ”Ž Similar Papers
2022-07-07Citations: 9
T
Thomas Bagrel
LORIA/Inria, MOSEL/VERIDIS, Villers-lรจs-Nancy, France and Tweag, OSPO, Paris, France
Arnaud Spiwack
Arnaud Spiwack
Director, Research, Tweag & Modus Create
Linear typesType TheoryConstructive Mathematics