news.volyx.in

There is no memory safety without thread safety (ralfj.de)

456 points by tavianator · 369 days ago · 503 comments on HN

Article summary

The article argues that memory safety and thread safety are closely related and that a language cannot be considered memory-safe if it is not thread-safe. The author uses the example of the Go programming language, which is often considered memory-safe but can still have memory safety issues due to data races. The article concludes that the concept of memory safety is not as clear-cut as it seems and that languages should strive to prevent undefined behavior. This requires a strong type system and careful consideration of concurrency issues.

Main themes

  • memory safety
  • thread safety
  • programming languages
  • concurrency
  • type systems
  • software correctness
  • performance vs safety trade-offs
  • formal methods

What commenters say

  • Some commenters argue that Go's lack of strong thread safety guarantees is a significant issue, while others downplay its importance.
  • Experienced programmers can avoid common pitfalls in Go, but subtle bugs can still occur.
  • Rust's strong type system and borrow checker can prevent certain types of bugs, but may come at the cost of increased complexity.
  • The choice of programming language depends on the specific needs of the project, with Rust being more suitable for high-performance and safety-critical applications.
  • Others argue that the productivity benefits of languages like Go and Python outweigh the potential risks of subtle bugs.
  • Some commenters believe that the concept of memory safety is not binary, but rather a spectrum, and that different languages offer different trade-offs.
  • The use of formal methods and proof assistants can help ensure the correctness of software, but may not be practical for all projects.