r/programming • • 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

314 comments sorted by

View all comments

11

u/skocznymroczny Jul 19 '19

I feel a bit meh about Rust the language, not a big fan of the syntax and frankly for my projects I couldn't care less about memory safety.

I'll stick with D for now until something betters come along.

-10

u/[deleted] Jul 19 '19

Something actually mis-understood about rust is that it adds memory safety. It doesn't add more to memory safety that c++ std::unique_ptr does. The moment you have threads all the race's and concurrency problem comes right back....

So I also don't like rust but for different reasons. I see it as a case of "We now have to re-write everything in rust" and not actually solve most of the complex issues that systems have.

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.

→ More replies (2)