Skip to content
Tech News
← Back to articles

Ante: A new way to blend borrow checking and reference counting

read original more articles
Why This Matters

Ante introduces a groundbreaking approach to combining reference counting and borrow checking without the risk of runtime crashes, a challenge that has stymied many programming languages. This innovation could enable developers to prototype and optimize code more flexibly, transitioning smoothly between different memory management strategies. Its success may influence future language designs, making memory safety more reliable and easier to implement.

Key Takeaways

Ante has taken the first step towards something we all thought was impossible: blending reference counting and borrow checking without run-time crashes. 0

This is very promising, because it means that someday, we can more easily use each approach when it makes sense without risking crashes. If there was a language like that, I could prototype a game in a flexible way with reference-counting, and gradually migrate it to faster borrow-checked code. 1

No mainstream language has figured out how to combine them seamlessly, even though many have tried.

Rust tried, but when we try to use Rust's reference-counting Rc type, it often requires RefCell (like Rc<RefCell<Spaceship>>) which can crash at run-time if you hold it wrong. 2 3 I wish rustc could check for proper Rc usage at compile-time! 4 5

Swift too has tried, with its new borrowing system, but it has an expensive run-time check which crashes at run-time if you hold it wrong.

It turns out, blending reference counting and borrow checking is hard, for reasons you'll see below.