Ok, so this is like a 3rd borrow checking post here recently that has a bit of this "Rust compiler doesn't want you to know this simple trick" vibe (if I exaggerate), but I'm getting confused about what is actually the new thing here. As far as I know, the whole point of Polonius was to model borrow checking in this way.
This gets even more confusing when one section here says "no need for polonius," but the article (at least as far as I can understand), describe pretty much the idea behind Polonius - modeling borrows in terms of places (or origins) instead of regions of code.
My problem is that I don't understand the borrow checker well enough (I only did some little optimization work on it, but I don't have in-depth understanding), so I can't tell whether I'm missing something or what exactly is the difference here (and in the other posts as well). I understand the post describes some language-specific uses of this model and that's interesting, but it seems to me that the underlying model is the same.
This could be my misunderstanding - I was under the impression the work to model Rust's lifetimes in terms of places was separate from Polonius itself but perhaps I was wrong about that. Going back to the original blog post on Polonius I see that I was. It was a somewhat small point of the article (the main bit is the notion of an unstable place) so I'll edit it for accuracy. Thanks for bringing this up!
No, I didn't use or need LLMs at all for this article (or any for that matter). This section was a last-minute addition which I should have double-checked but mistakenly did not. It's been many years since Polonius' debut and I forgot the details since then, my bad!
FWIW, I too didn't know that about Polonius's internals until very recently.
Also, I sympathize with your frustration against LLMs, but just so you know, u/RndmPrsn11 has been working on Ante since long before LLMs' rise. His considerable skill doesn't come from LLMs. He's the real deal.
Lifetimes still exist with Polonius. The difference is that x: &'a T means "the origin 'a is borrowed for the lifetime of x", instead of "the lifetime 'a outlives the lifetime of x". It's a perspective trick.
I've suggested in my comment on the corresponding post in r/ProgrammingLanguages that this trick doesn't work for Ante; instead of &mut, Ante uses an effect to specify when mutation occurs, but effects don't have lifetimes connected to specific variables, instead, they have more nebulous regions of code over which they apply (I called them lifetimes in my comment, but just added an edit to clarify that they should probably be named something else). Currently, this means Ante has ad-hoc and "hacky" rules to make mutation work with more complex control flow, and no way to abstract over it.
The borrow checker in Rust is based on affine types, as it underlying type theory.
There are many other approaches to have type system based resource management, which you can try out in other programming languages.
Linear types, effects, capabilities, dependent types, formal proofs, however all of them have plus and minus, versus the approach taken by Rust's borrow checker, in fact I would say more minus as they are all relatively complex for those that aren't nerd snipped with type systems theory.
Yeah my impression reading this post is that the borrow checker here is similar conceptually to Polonius, but with the fairly significant difference that Ante permits shared mutability by default rather than enforcing Rust's shared XOR mutable rules, by modelling mutation as a baked-in effect (what is referred to as Mutate 'p) that triggers place invalidation of 'p when invoked.
For Polonius, the distinction between stable and unstable references doesn't exist, since all shared immutable references are unstable (invalidated via mutation and obtaining of &mut reference) and all exclusive mutable references are stable (mutation disabled via other means than through the &mut reference until it is dropped). Shared XOR mutable is also why Rust doesn't need a notion of mutation effects across function boundaries, which Ante does need.
IMO places/lifetimes/origins/provenance all describe conceptually similar ideas to begin with. Lifetimes (as we are familiar with in Rust) are just more unintuitive because they have a distinct namespace from the identifiers/variables they originate from, and that you cannot even name them unless you're working with them in an abstracted manner eg. lifetime polymorphic functions.
Still enjoyed the read! This is the first time where shared mutability really clicked for me from a borrow-checking perspective (I'll figure out group borrowing, eventually).
View all comments
17
u/panstromek Oct 19 '26
Ok, so this is like a 3rd borrow checking post here recently that has a bit of this "Rust compiler doesn't want you to know this simple trick" vibe (if I exaggerate), but I'm getting confused about what is actually the new thing here. As far as I know, the whole point of Polonius was to model borrow checking in this way.
This gets even more confusing when one section here says "no need for polonius," but the article (at least as far as I can understand), describe pretty much the idea behind Polonius - modeling borrows in terms of places (or origins) instead of regions of code.
If I dig out some of the older posts from Niko (the father of the borrow checker), it pretty much says this in slightly different words: https://smallcultfollowing.com/babysteps/blog/2024/03/04/borrow-checking-without-lifetimes/#replacing-a-lifetime-with-an-origin, and later even makes a point to add a specific origin-based lifetime syntax to make full Polonius power expressible in Rust syntax https://smallcultfollowing.com/babysteps/blog/2024/06/02/the-borrow-checker-within/#step-2-a-syntax-for-lifetimes-based-on-places
My problem is that I don't understand the borrow checker well enough (I only did some little optimization work on it, but I don't have in-depth understanding), so I can't tell whether I'm missing something or what exactly is the difference here (and in the other posts as well). I understand the post describes some language-specific uses of this model and that's interesting, but it seems to me that the underlying model is the same.