3 ms·
My takeaways: >"What Tony Hoare was writing about when he said that references [a.k.a. pointers] are like jumps was the problem of mutable, aliased state. If
by peter_d_sherman 2y ago
My takeaways:
>"What Tony Hoare was writing about when he said that references [a.k.a. pointers] are like jumps was the problem of mutable, aliased state.
If you have in a language the ability to alias two variables so that they refer to the same location in memory, and also the ability to assign values to variables as execution progresses, your ability to locally reason about the behavior of a component of your system becomes badly inhibited." (PDS: This is especially true for code which is shared by multiple threads!)
Related article: "Understanding Pointer Aliasing in C and the `restrict` Keyword": https://hasanisaeed.medium.com/understanding-pointer-aliasing-in-c-and-the-restrict-keyword-7da125967a90 https://hasanisaeed.medium.com/understanding-pointer-aliasin...
>"Depriving the user of the ability to mutate aliased state by accident is critical to enabling the user to easily create correctly functioning systems.
[...]
Rust’s entire claim to fame is that it has shipped a type system intended to solve this problem.
In Rust, references [a.k.a. pointers] are mutable or aliased, but never both
, and the entire system of lifetime variables and borrow analysis is designed to ensure that this remains true."
Related: https://en.wikipedia.org/wiki/Rust_(programming_language) https://en.wikipedia.org/wiki/Rust_(programming_language)