Hacker Read top | best | new | newcomments | leaders | about | bookmarklet login

Rust is no harder to learn well than C, as someone else has already commented.

My experience is the opposite of this. Back when dinosaurs walked the earth, I moved from one system language (Ada) to C and, in a couple of months, I was writing device drivers. I have struggled with Rust on hobby projects for a few years and have given it up 3 times -- this is despite having 18 years of C++ experience.

I would not say that you are wrong, just that this statement about the learning curve is not true for everyone.



view as:

Would you mind going into more detail about what you found hard about learning Rust? I'm interested in a counter perspective as someone who hasn't learned it yet and has mostly only seen positive media about it.

Please don't let my negative experience put you off learning Rust -- its an important language and worth putting the effort in. I would recommend diving in and seeing if it works for you.

For informational purposes, this is what I still find difficult:

- The module system. It constantly catches me out.

- I think that I understand traits but struggle using libraries that have a lot of traits in the public interface.

- Error handling is nice but there are error handling libraries going in and out of fashion every few months. Which one do I use?

- Callbacks combined with the borrow checker.

- Complexity of idiomatic code such as state machines [1].

- The strict string handling. What about strings that should be UTF-8 but come over a network protocol?

- Combining async code with non-async code. Also, how do you write a library that does I/O and supports both sync and async?

- Iterators. I have some functional programming experience but I hit problems with iterators combined with the borrow checker.

[1] This example has just 3 states and is much simpler than most real world examples: https://hoverbear.org/blog/rust-state-machine-pattern/


Thanks, there are some good pain points there.

> - The strict string handling. What about strings that should be UTF-8 but come over a network protocol?

From your description, it looks like you're looking for String::{from_utf8,from_utf8_lossy,from_utf8_unchecked}[0], but I'm guessing you've seen those already, so I'm confused.

> - Combining async code with non-async code. Also, how do you write a library that does I/O and supports both sync and async?

I think you'll have to just duplicate the code, but I'd be happy to be proven wrong.

[0]: https://doc.rust-lang.org/std/string/struct.String.html#meth...


Legal | privacy