HackerPapers

arXiv:2106.12678cs.PL

Native Implementation of Mutable Value Semantics

Dimitri Racordon, Denys Shabalin, Daniel Zheng, Dave Abrahams, Brennan Saeta

Abstract

Unrestricted mutation of shared state is a source of many well-known problems. The predominant safe solutions are pure functional programming, which bans mutation outright, and flow sensitive type systems, which depend on sophisticated typing rules. Mutable value semantics is a third approach that bans sharing instead of mutation, thereby supporting part-wise in-place mutation and local reasoning, while maintaining a simple type system. In the purest form of mutable value semantics, references are second-class: they are only created implicitly, at function boundaries, and cannot be stored in variables or object fields. Hence, variables can never share mutable state. Because references are often regarded as an indispensable tool to write efficient programs, it is legitimate to wonder whether such a discipline can compete other approaches. As a basis for answering that question, we demonstrate how a language featuring mutable value semantics can be compiled to efficient native code. This approach relies on stack allocation for static garbage collection and leverages runtime knowledge to sidestep unnecessary copies.

arXiv comments
4 pages; to be published at ICOOOLPS 2021
Journal reference
DOI
Subjects
cs.PLProgramming Languages

On Hacker News

Linked by 2 identifiable commenters in 2 comments across 2 threads, from Feb 2023 to Oct 2023. Found in 3 HN submissions from Jul 2021 to Apr 2023. Open submission discussions.

Comments linking this paper, per year.

Discussed in comments2 threads

    • Some relevant PL research STM: https://cs.brown.edu/~mph/HerlihyM93/herlihy93transactional.... Region based memory management: https://en.wikipedia.org/wiki/Region-based_memory_management Rust lifetimes, originally from Cyclone…

      justinpombrioView on HNParent context

  1. Value-Oriented Programming 1 comment
    • This is interesting, thanks. That's a lot to read but I'm working my way through it. I read a whitepaper on value semantics: https://arxiv.org/pdf/2106.12678.pdf I think it's promising. I've been working on multithreaded code that passes references around. If you hold the…

      samsquireView on HNParent context

Submitted to Hacker News

Connected through shared HN threads, not inferred similarity or a recommendation.