Ask HN: What was your biggest mental shift when learning Rust? - mrburton
======
sudeepj
Ownership. There are other things but this is the single biggest adjustment
one will have to make.

In other languages say C++/Go/Python, you have a shared buffer in two threads.
Both threads have mutable access to it but you _know_ 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 _prove_ it to the Rust compiler at _compile
time_ that this invariant is true. In Rust you express this using its type
system. Syntactically & semantically it is very different than other
languages.

The implication of the above is that in Rust you will have think a lot about
your code structure & 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 & others think it as impediment to the productivity. Both points are
valid in my opinion ... it more of a question of cost vs benefit.

