TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: What was your biggest mental shift when learning Rust?

4 pointsby mrburtonover 5 years ago

1 comment

sudeepjover 5 years ago
Ownership. There are other things but this is the single biggest adjustment one will have to make.<p>In other languages say C++&#x2F;Go&#x2F;Python, you have a shared buffer in two threads. Both threads have mutable access to it but you <i>know</i> only one of them is modifying it at any point of time (because you wrote it :) ). This is not good enough in Rust. You will have to <i>prove</i> it to the Rust compiler at <i>compile time</i> that this invariant is true. In Rust you express this using its type system. Syntactically &amp; semantically it is very different than other languages.<p>The implication of the above is that in Rust you will have think a lot about your code structure &amp; data-flow upfront compared to other languages else you will hit the wall very frequently. Some people say this is how it should be anyway &amp; others think it as impediment to the productivity. Both points are valid in my opinion ... it more of a question of cost vs benefit.