3 ms·
These articles explain the mathematical underpinnings of Rust's borrow checker. The explanation is actually fairly simple, but it assumes prior familiarity with
by ekidd 10y ago
These articles explain the mathematical underpinnings of Rust's borrow checker. The explanation is actually fairly simple, but it assumes prior familiarity with abstract algebra.
For people who are unfamiliar with posets, lattices, etc., this introduction might help a bit: http://old.iseclab.org/people/enji/infosys/lattice_tutorial.pdf http://old.iseclab.org/people/enji/infosys/lattice_tutorial.... (PDF)
For introduction to how Rust's ownership/borrowing/lifetimes system works, see the three chapters starting here: https://doc.rust-lang.org/book/ownership.html https://doc.rust-lang.org/book/ownership.html
And a "standard disclaimer" for math: To understand this material, you may need to read slowly, look things up, and work through each example. Math is often very simple, but that doesn't mean that it's easy. The trick is usually to stare at it from enough different directions that the underlying simplicity finally "clicks," and you wonder how you could have ever been confused. If you're unfamiliar with the topics in question, a page per day can be a perfectly acceptable reading speed.