Comment by perryizgr8

4 years ago

> also prevents data races in concurrent programs.

I have another neat trick to avoid races. Just write single threaded programs. Whenever you think you need another thread, you either don't need it, or you need another program.

You do realize that data races can happen between multiple programs as well, when shared resources are used? Which is pretty much a requirement for many things.

  • Yes, and rust can't prevent those.

    • It can prevent data races in memory shared between processes in the same way it can prevent them in memory shared between threads. Data race prevention isn't built into the Rust language, it is constructed using a combination of the borrow checker and the type system.

      2 replies →