Help me stop hating rust

11 points by matt3210 ↗ HN
I think it might be time to get onboard with rust.

I'm a 20 year c/c++ developer and doing c since I was 12 and the idea of rust infuriates me but I want to deprogram my mind from that.

What does the community think is a good place to learn rust for someone with a strong c++ background?

27 comments

[ 2.7 ms ] story [ 67.2 ms ] thread
Why stop? Someone has to hate Rust and you seem qualified.
you hating rust wont change anything... but either way... learning any language is about the same process
Looking for a resource not focused on new developers.
You could skim through the topics you know well. In my experience, most Rust resources are not targeting beginner developers.
It can be tricky to find learning resources that is perfectly tailored to the exact point we’re you’re standing right now. Especially if you already have prior experience.

But since you’re already familiar with programming, perhaps just dive right in…?

I.e. start a new project in Rust. You could do something like Advent of Code, Project Euler or Cryptopals[0]. Or write a simple webserver or whatever you feel like.

Don’t forget that ChatGPT can be quite useful for stuff like this. You can use it like a mentor. Just ask it anything you want to, make it show you examples (and then more examples) and so on. The answers might not be correct all of the time, but at least it can give you an idea of what docs to read next.

If you’re looking for blog posts, an acquaintance of mine has written some: https://priver.dev/tags/rust/

For more links to code/learning resources, see https://github.com/rust-unofficial/awesome-rust

And if you get stuck you also have the official Rust chats on Zulip/Discord.

HTH. Best of luck!

[0] https://cryptopals.com/

whatever your reasons for hating the idea of rust, you’ll have so much leas hatred if you go and learn scala first. then, renewed with perspective on what C++ has inculcated in your implicit ideology of SW, you can come at rust with a different target of hatred held in your heart.

on the light side of the force, nrc has provided https://github.com/nrc/r4cppp for some time, you may enjoy its accelerated approach.

> whatever your reasons for hating the idea of rust, you’ll have so much leas hatred if you go and learn scala first.

Sounds like a lot of work for someone who does not want to use Scala, though.

you don’t need to learn rust. it’s ok to do what you want. there is enough work out there and you have a choice.
Identify what it is you hate, then validate whether it's actually warranted by writing a toy application that addresses the issues. If successful, call it "Therapeutic coding" and write a pretentious medium/substack article on it
Hate is a strong emotion, seemingly irrational, but you cannot eradicate it without finding its source. Sit with the hate, define it, trace it to understand where it stems from, and you might learn why do you feel such a strong emotion for a programming language, and, more importantly, you might learn about yourself.

There is no deprogramming hate without understanding it first.

To answer your last question;

Start with the Rust book.

https://doc.rust-lang.org/book/

Then do Rustlings until the syntax becomes muscle memory.

Then join the Discord and start doing little projects.

You won’t get up to the proficiency of other languages as quickly in Rust. It takes longer. For me it’s taking a lot longer, but I enjoy it.

I was rust agnostic, but starting a new job that uses rust. Reading the O'Reilly book Programming Rust gave me positive feels for it. Actually using Rust, not so much, so if you just want to stop hating it, I say read the book, and don't actually use it ;)
> Actually using Rust, not so much

Would you care to elaborate? There are some pain points that we're aware of, some of which we're actively working on, but there might be some you encountered that we don't know about and it would be helpful to find out about them so we can potentially address them in the future.

Honestly, I don't think it's anything outside the usual suspects, but hopefully this brain dump is useful.

1) compiling is slowwwww, and something about my workplace environment (docker builds) means there's a lot of downloading and a lot of disk space used. cargo clean is helpful, and I blame docker more than Rust here. I am running in a VM, but I've had to increase the allocation to 150 G to run a fairly barebones Linux environment (no desktop) and not have to clean up my environment frequently. Some of my other environmental stuff is also super slow, so I'm pretty grumpy about speed in general.

1a) I've had cargo fmt eat my files when I was out of disk space. It created a new file, but the file length was 0, and my old file was gone. (I did not open a bug report)

1b) I hate how my dependency tree has about 700 items, but I still have to update h2 for a http/2 server security bug to make cargo audit happy, when AFAIK, we don't even use http/2 at all. (we do use hyper, and aws-sdk)

1c) There's about 7 different ways to get at epoll from Rust, but I don't think any of them let you set a sub-ms timeout, unless you use a timerfd (at least one of the 7 ways does do the timerfd for you, but that doesn't make it better, just easier). Why doesn't anyone make epoll_pwait2 available somehow. Although, really, this is more of a question of why didn't Linux offer a useful timeout in epoll_wait to begin with. If I were more familiar with Rust, maybe I'd be confident in just doing it myself, like I can in other languages, but it still seems scary.

2) It's pretty difficult to figure out what my system is doing from the outside. But I'm used to Erlang's introspection, and I was tempted to think that some of the features of Rust would make it Erlang-ish. Maybe I just need to use tokio_console, but it's not there by default, and I'm not sure how I would connect up to my running production system. This is probably more of a me problem or a my environment problem than a Rust problem.

Thank you, this is indeed useful.
Oh here's one more, from just now.

I'm trying to figure out what how set_read_timeout on a UdpSocket works, so I'm here: https://doc.rust-lang.org/src/std/net/udp.rs.html#308-310 and click get source (which is nice to have! and is usually helpful) which takes me here https://doc.rust-lang.org/src/std/net/udp.rs.html#308-310

In this case, this is profoundly unhelpful. There's no way to get from this page to wherever it is I need to be; there's no way to navigate to any other file from here. I'm not really mad, I'm just disappointed --- you set me up for success with this great get source link, and then I gotta just go jump through the source on my own anyway.

Support for code navigation in the rust doc provided sources was implemented some time back. I think it wasn't enabled by default due to HTML bloat, it made the pages too big and slow to render on larger files. It'd be nice to revisit that and get it over the finish line. This is something I want too.
I feel your pain. For me the biggest hurdle was taken away once I realized the following 3 things:

- everything in Rust-land is named differently. They are not different, but use different names.

- nothing wants to be a value

- nothing is implemented by default.

If you can get those 3 items in your brain, you can start thinking in Rust. Coming from one c++ dev to another; You may still not like the language. I know I dont, even though I agree with the premise that defaults should be ‘safe’

You shouldn't hate or love any language, just like you shouldn't hate or love one screwdriver over another.

Rust overall has a limited lifespan, just like most other languages, because at a certain point high level languages (or really probably just Python due to its prevalence in ML community) is going to get mapped onto extremely efficient machine code through pattern recognition, and you get all the advantages of fast development and fast execution, as well as memory and type safety (the latter enabled by ML powered type checkers, and intelligent unit tests that may very well likely be auto written for you).

The reason to chose Rust today is when you have critical code that is worked on by many people that also needs to be fast. The structure of the language is pretty good for keeping things clean and consistent (unless you get lazy and start using a bunch of unsafes... which is somewhat unavoidable if you end up extremely performant code that touches Kernel stuff, see Amazon Firecracker).

If you personally can code extremely well in C, learning Rust gives you no real advantage other than just expanding your skillset for potential niche jobs. And even then, most competent companies in hiring would recognize that if you are very proficient in C, you can probably pick up Rust pretty easy.

> ... as well as memory and type safety (the latter enabled by ML powered type checkers...

I find that highly unlikely.

I'm a c# developer and architect since 20+ years and stumbled over rust the other day. I always wanted to learn a low level language and the syntax of rust is, for ME, just right and already fits well into MY known think-patterns.

I guess it's the right time to look into rust, learn the eco system and patterns before it gets too large to learn, as c# nowadays.

>at a certain point high level languages (or really probably just Python due to its prevalence in ML community) is going to get mapped onto extremely efficient machine code

Strong assumption. Is this just an isolated opinion or a likely outcome that many HN'ers assume?

Not so much assumption as reality. And as memory bottlenecks become more and more severe the problem gets easier and easier.
You don't need to get onboard with it, I bet that there'll be C/C++ jobs for a long time.

Just learn Rust if you would like to. It isn't as good as people pretend it to be, as with any technology, it has plenty of tradeoffs, even when compared to C/C++.

I can’t speak to Rust, but these past 6 months I’ve had a very interesting adventure diving into Ruby on Rails. My background is full stack JS dev with Typescript. So I like my shit explicit written out, no magic. I like my shit strongly-typed. And I like my shit running primarily on the front-end.

Well I had several sour run-ins with Ruby on Rails and I had decided that it was the worst thing ever and I hated it. And I valiantly defended that position for many years. However, recently I’ve had several roles that required me to use Rails in various ways and I managed to find one or two things that I found… interesting… about it.

So I decided I was going to learn Ruby on Rails just so I could see what all the fuss was about and then I could _know_ I was right and throw it in all those smug Ruby-ist’s faces!

Long story short, I’ve learned a great deal and I’ve come to appreciate many of the design decisions that Rails has made over the years. It’s very opinionated which can go either way, but what it sets out to do, it does very well. I am actually building a Rails application using turbo and it’s been mind-expanding and a total joy to use.

To that end, I can only recommend going in to “prove yourself right” and you may find that you prove yourself wrong.

I still hate Ruby as a duck-typed, dynamic language. I will jump ship at the first full stack web framework that is as comprehensive as Rails but has full-stack, native Typescript runtime. (Hoping for some deno project to fill that void!)

But until then, I’ve come to appreciate and even enjoy Rails.

Don’t ask me. I hate rust too, especially the personality of the people working on it. Open to change my mind tho