Resource Polymorphism
Guillaume Munch-Maccagnoni

TL;DR
This paper proposes an extension to OCaml that incorporates resource polymorphism, destructors, and move semantics, aiming to enhance safety, efficiency, and expressiveness while maintaining compatibility with existing code and runtime.
Contribution
It introduces a novel resource-management model for OCaml inspired by systems programming languages and linear logic, combining RAII idioms with garbage collection and resource polymorphism.
Findings
The model is backwards-compatible with current OCaml code.
It integrates seamlessly with existing garbage collection.
The approach supports resource-polymorphic libraries and is compatible with multicore extensions.
Abstract
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…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsLogic, programming, and type systems · Parallel Computing and Optimization Techniques · Distributed systems and fault tolerance
