A detailed exploration of borrow checker design based on linear types, written in the context of the Hare programming language. Covers the distinction between linear and free types, reference vs. pointer semantics, atomic swap and atomic free operators for safe array/struct manipulation, optional defer for leak-safe error handling, borrowed vs. owned slices and strings, and explicit lifetime annotations in function prototypes. Comparisons are drawn to Rust's destructors and Austral's struct unpacking. The notes read as a language design document proposing these features.
Table of contents
Basics of linear typesCreating linear typesDestructing linearsArrays/slicesSlice allocationPointers vs. referencesError handling and deferBorrowed strings and slicesLifetime annotationsSort: