Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This is completely tangential to language “safety” as it’s commonly referred to when discussing languages like Rust and C or C++. Typically, I’ve only heard safety used to mean memory corruption, out of bounds memory access, and undefined behavior are not allowed, or throw runtime exceptions when they happen.

Java’s standard HashMap isn’t thread safe, it has ConcurrentHashMap[0] for this reason. And I’ve never heard somebody refer to Java as an unsafe language. Lemire wrote a blog article arguing Java is unsafe for similar reasons that it seems you’re using here, and I think the comments section has some great discussion about whether this conflation of language safety makes sense or not[1].

And one final point: a lot of the world lives on software segregated across several different machines, operating asynchronously on the same task, usually trying to retrieve some data in some central data store on yet another machine. Rust is great for locking down a single monolithic system, but even Rust can’t catch data races, deadlocks, and corruption that occurs when you’re dealing with a massively distributed system. See this article that talks about how Rust doesn’t prevent all data races, and why it’s probably infeasible to do that[2]. And I doubt anyone here is about to call Rust unsafe :)

This conflation of language often confuses me and I hope as an industry we can disambiguate things like this. Memory safety is distinct from thread safety for a reason, and by all reasonable standards Go is as safe as a modern language is expected to be. (Obviously better thread safety is a goal to be lauded, but as an industry, it seems like we’re still trying stuff out and seeing what sticks in regards to that).

[0]: https://docs.oracle.com/javase/6/docs/api/java/util/concurre...

[1]: https://lemire.me/blog/2019/03/28/java-is-not-a-safe-languag...

[2]: https://doc.rust-lang.org/nomicon/races.html



> Memory safety is distinct from thread safety

From [2] you linked

> a race condition can't violate memory safety in a Rust program on its own.

From golang FAQ on maps not being atomic:

> uncontrolled map access can crash the program

This may be one very narrow case (or a more common theme), but at least in this case the thread safety becomes a memory safety concern in golang.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: