Happy new year! It’s all very foggy and cold outside, and the world is just waking up. I’ll be doing all the new years resolutions, and let’s hope they’ll last.
After some more doodling about, it occurred to me that the actual power of Rust is not the borrow checker (honestly, it can be quite annoying and slowing progress), but the zero-cost abstractions. You can define entire buildings full of generics, traits and structs, and if you’re smart about it, the Rust compiler will optimize most of it away entirely.
This is nothing new, of course. A modern C++ compiler is also able to devirtualize classes, inline methods and remove structures and pointers, but when trying to optimize too aggressively, you can run into buggy situations. C++ as a language relies on a more traditional model of what a program is and does. It was never designed for these type of optimizations.
And Rust actually is.