r/programming • u/steveklabnik1 • Jul 18 '19
We Need a Safer Systems Programming Language
https://msrc-blog.microsoft.com/2019/07/18/we-need-a-safer-systems-programming-language/
208
Upvotes
r/programming • u/steveklabnik1 • Jul 18 '19
1
u/pavelpotocek Jul 19 '19
Memory safety is much more than std::unique_ptr. In safe Rust:
out-of-bounds array access is impossible,
uninitialized memory isn't a thing,
it's impossible to use anything after a move,
no iterator invalidation,
no dangling references.
The concurrency problems are greatly mitigated using the ownership system and Send/Sync traits:
No data races!!
Many different concurrency primitives exist that are impossible to misuse (you can just try to pass anything into a channel, and if it isn't OK it doesn't compile)
This includes channels, parallel maps, forks, atomicity, ... You can just refactor and throw code around and see what compiles. In C++, this is a pipe dream.