3 ms·
Performance is not the only benefit. You also get freedom from data races, and (arguably) the borrow checker imposes structure that makes the program easier to
by mpartel 8y ago
Performance is not the only benefit. You also get freedom from data races, and (arguably) the borrow checker imposes structure that makes the program easier to read and reason about, because it's clearer who "owns" (and can mutate) what, and what is shared.
I've missed this property when writing Java and JS even before Rust was a thing, and Go has felt the same.
- Thiez 8y agoExactly, the clear ownership in Rust allows you to skip the defensive copying that so often happens in Java. Of course you get this property in most languages that do not use garbage collection, but I few restrict mutable aliasing.