DEV Community

loading...

What are some things you wish you had known when you started learning Rust?

yjdoc2 profile image YJDoc2 ・1 min read

Hello!
I am giving a talk at my college to introduce Rust to some people. Most of them have not used it or even heard of it, so it is aimed to cover only the basic introduction of Rust.

I would like to know your opinions on the following, so I can try and make the introduction better for them.

  • What similarity/ies did you find in Rust and some other language you know ?
  • What are some features of Rust you wish you had known / had more emphasis, when you started learning Rust? (good or bad)

For me, I wish I knew how expressible and powerful match expressions can be. Even though I knew match expressions, it took some time before I really grasped how much powerful and expressive they can be, combined with Enums or ranges.

I also wish I had learnt threading with a bit more emphasis, I know one of the goals of Rust is to make Secure multi-threading easier, but I wish I had seen some more examples of really how much Rust makes it simple to introduce multi-threading as well as make sure its correct/you don't shoot yourself in foot.

So, please share your thoughts if possible, in the comments.
Thank you! :)

Discussion (3)

Collapse
dynamicsquid profile image
DynamicSquid

I really wished I learned how the memory ownership worked before I started coding a transpiler (which was my first Rust project). I thought yeah, I code C++, I'm familiar with pointers, Rust shouldn't be a big deal. Then couple hundred lines in I realized how wrong I was :/

Collapse
wisehuang profile image
Jonathan Huang

Agree, I write code for more than 20 years, and I think it's easy to learn any new language based on my knowledge, and then I failed to understand how Rust's memory management before reading the document.
Take two or three hours to study how it works will save tons of your time to fight with the Rust compiler.

Collapse
yjdoc2 profile image
YJDoc2 Author

Thanks for the reply!
Yeah, I think ownership is quite a unique feature of rust, and takes some time to grasp. I too kept tripping on it initially when I started learning Rust , and sometimes still do :) :)

Forem Open with the Forem app