A Go programmer’s first day with Rust

Where is the tutorial? The first Google hit gives a redirect to a page explaining that I should read the book. The first page of the book explains that I should read the Second Edition unless I want to go deep, then I should later read the First Edition also (and presumably ignore the things that had been changed later in the Second Edition?)

OK, let’s do this thing! Get rust-mode installed in Emacs, and get it to call rustfmt on save, because Go taught me that the tab button is from 1960 and I don’t use it anymore.

Search for “why is rustc hanging while compiling rustfmt”. Find closed issue from someone who did the same thing. He says, “in the 6 minutes it took me to make this issue, it finally finished compiling”. I go back to my compilation window and find the same thing. Why is Rust’s compiler so slow?

OK, let’s do this thing! Wait, why is rustfmt making different format than the tutorial? Try some stuff, find out rustfmt wants me to upgrade my compiler to nightly, tell it, “No, my friend, that’s not going to happen. I rode that train with Go and it made me crazy.” Give up and accept that rustfmt is fighting the tutorial to teach me different formats for Rust. I miss gofmt.

Play with the example code in the tutorial, make syntax errors on purpose. The compiler error messages are… trying to be helpful, but as a result are too big to fit in my window. Rust developers must have bigger monitors than me. It is surprisingly difficult to say the minimal helpful thing. “I would have written a shorter error message, but I didn’t have time.”

Read about Results and how they encapsulate the return value. This is really elegant and pretty.

Tried making some code with and without mut and I think I’ve got it more or less. I understand why this is important, but I’m still pretty suspicious that it should be my job as a programmer to keep track of this. Wonder if there should be a rustfmt plugin where it adds in the mut’s that I’m not interested in keeping track of myself?

I would rate this 60 minute session of Rusting as about a 3 out of 10 on the “that was fun and I’d like to learn more of that” scale. Let’s see how the next hour goes…

Leave a Reply