What I like about Rust


I really like Rust. It hits a lot of points for me.

First, it's expression based: everything returns something that you can inspect and pass around, even if that "something" is a Unit type. This is something I really appreciated about Ruby, and about many functional languages like Scala and Clojure, back when I used them more.

I like that Rust targets and achieves performance on par with C. Performance, to me, is a desirable quality in a language, for a few reasons. One of the most obvious ways to improve performance is to do less work, and the process of figuring out which work to not do is often the same as figuring out which work was never worth doing in the first place. Performance opens up new classes of solutions. Approaches that would be too slow in other languages are often now within grasp when I use Rust. I like that Rust lets me use an arena allocator if I want to. I like that Rust lets me start with immutable data and move to immutable data if it makes more sense for the problem or the desired performance profile. I like that I don't worry about whether or not a garbage collector is going to stop running my program for some amount of time of its choosing. I like that I can reusing allocations. I like that I can preallocate when I know exactly how many things I have. I like that Rust makes all of this stuff possible, but doesn't burden me with it unless I want/need it for my current problem. I can write immutable, high-level functional code and move over to bashing arrays in place if necessary. Even better, the immutable, high-level code is often fast enough anyway!

Other than the language itself, the tooling surrounding Rust is first-class. There's no other way to put it. rust-analyzer in vscode is a great IDE experience. docs.rs is probably the best language/library documentation I've ever used. Cargo is without a doubt the best build tool I've used. crates.io is the best package repository I've used. This lends itself to a holistic development and deployment experience that is just enjoyable. With so many other languages, I enjoy the language itself but find other things underwhelming, sometimes to the point of misery. For example, Clojure with its documentation and stagnant libraries, the calamity that is Scala's SBT, Elixir with its meh editor/IDE experience. You get the idea.

Rust's focus on reliability is real, and nearly unique among languages today. There is no doubt that the typesystem and ownership system have a significant learning curve, especially if you've never used static types before. That investment is rewarded, in my experience. I can't tell you the number of times the compiler has caught things that would have otherwise been bugs: unhandled nulls, unhandled branches, memory unsafety, accidentally sharing unlocked data between threads, forgetting to fix a specific callsite after changing a function signature or datatype, the list goes on and on. Of course there's a cost to this. Developing Rust is probably not going to be the best "get it into production NOW" language out there, but it may well be among the best language out there for sustainable development. Returning to my Rust projects over time, both personal and work, has significantly lower cost than in other languages, especially dynamic languages. I have less fear of what something is doing, I have less fear of making extensive changes or rewriting large portions of a codebase. Of course none of this is quantifiable or falsifiable, but neither is being able to say one couch is more comfortable than another. And the intangible quality of "solid" that I get from Rust separates it from every other language I've used.

Probably the best thing about Rust, though, is its culture. The Rust community is welcoming and humane. The Rust community, more than any I've seen, really works hard to bring new people into the fold of writing systems software (including me). I've learned so much from the Rust community in such a short amount of time, and that's no accident. It's due to the encouraging nature of the people in the community. It's rare to have such a welcoming culture around a programming tool, so Rust really stands out in this regard, and I hope it continues to do so.

Rust is really special. Of course there are things I don't like about Rust, but that's for another post. Overall the language, tooling, and community have made me feel more at home than any other language I've learned so far, and I hope Rust continues to introduce new people to building systems software for many years to come.