Rust: First impressions

My new company uses Rust heavily for its backend systems. I’ve been interested in Rust since its beta days, but only from a distance. I was very intrigued by the ownership system, which is Rust’s most distinctive and innovative feature. I also knew it inherited a lot from languages like Scala and OCaml. How hard could it be?

Read on for some loosely organized hot takes.

Ownership: Meh

I’ve never worked on extremely high performance, resource constrained code, and so the problems that the ownership system addresses aren’t super relevant to me. But what’s clear to me is that the ownership pervades the language experience. You can’t do things that would be simple in JavaScript or Scala without knowing what you’re doing. Immediately, I ran into hard to interpret errors and the need to try to parse the docs.

Manual memory management isn’t all that bad in simple situations. But I can definitely see how the ownership system is much, much safer.

But it would be sweet to be able to opt in to a garbage collected version of Rust with the value & reference semantics that most programmers are accustomed to.

Very Scala!

Probably more than any other language I’ve messed with, I can see the influence of Scala. There are very similar parallels to features Scala popularized, like implicits, traits, type members, and type bounds. Rust’s async model feels very familiar to me from Scala’s. The similarities helped immensely, letting me quickly understand features that took me weeks to master in Scala.

Rust seems to have a little less raw power in its equivalents and more opinion. But that’s not a bad thing at all. Scala — at least in the Scala 2 days — is well known for allowing extremely divergent styles of programming.

Cargo cult

I haven’t had to do anything complicated in for my project yet, but I have to say that Cargo is by far the best build tool I’ve seen. It just works. It doesn’t require me to learn complicated concepts. Pretty much every other language I’ve worked with threw major speedbumps in my path when I was just trying to get started. And most other languages still have convoluted build tooling. I’m sure a lot of thought went into Cargo’s design, and it shows.

Airing of grievances

My other minor complaints:

  • Strings and string slices are irritating. It feels like it should be easier.
  • I miss Scala’s collections framework, and I was expecting better in Rust. i wanted to write a utility function to take the first 20 characters and last 20 characters of a string, for the purposes of abbreviation. It’s laughably convoluted.

Not bad, so far

I’m looking forward to learning more Rust. I’m only a week in, and I think I’m getting past the worst of it with learning the ownership system. And based on how helpful ChatGPT has been in answering questions and helping me interpret compiler errors, I think LLMs are going to be a game changer for people being able to use languages like Rust, which give you a lot of safety and performance in return for the restrictiveness.

Leave a comment