3 ms·
Ask HN: Rust – does it get better?
I've started learning Rust in my spare time. Like most people, it's been an uphill struggle getting used to thinking in terms of ownership and borrowing.
Obviously this will get better with time. What I'm wondering is, how much? Once you really master the borrow checker, are you able to move as fast in Rust as you can in other languages, or is there always overhead in the form of added concerns to think about and work through? Does borrowing become second-nature, or does it remain a tradeoff?
- db48x 7y agoYes and no. Once you've got some practice under your belt, you'll be able to decide what the ownership structures will look like ahead of time. You'll either avoid circular ownership entirely, or you'll decide ahead of time that you're just going to have to bite the bullet and use runtime bookkeeping of some kind (Rc/Arc/etc). A lot of this is domain-specific knowledge though; if you've gotten really good at writing a game using ECS then the specifics of that might not help you much if you start writing a line of business app or a web page. The ownership and borrowing rules are the same though, so it's not a complete loss.
- sudeepj 7y agoIn my experience it does get better, but for most of the people to expect to be productive as they would in Golang, Python, etc would be unrealistic. Rust changed my thought process permanently because it forces you to think a lot of things upfront. Also, this "skill" is transferable to other languages which makes learning Rust worth it at the first place.
- steveklabnik 7y agoIf I am not missing libraries, I’m faster in Rust. I spend way less time debugging and writing tests. YMMV. The borrow checker doesn’t cause thinking, it removes it. I just write code, the compiler checks my work and tells me how to fix things when it messes up.