3 ms·
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 ye
by faceplanted 6y ago
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.
- papaf 6y agoPlease 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/ https://hoverbear.org/blog/rust-state-machine-pattern/
- creata 6y agoThanks, 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#method.from_utf8 https://doc.rust-lang.org/std/string/struct.String.html#meth...