4 ms·
While it's true that memory safety has been done in a lot of languages for a long time this overstates the point. Doing memory safety at compile time is an impo
by pedrocr 4y ago
While it's true that memory safety has been done in a lot of languages for a long time this overstates the point. Doing memory safety at compile time is an important change that allows replacing C/C++ in a lot more situations. In the benchmarks game for example Rust has been the only language capable of breaking into the C/C++ league, even after very many years of investment into Java for example.
Rust also uses the same mechanisms to get compile time thread safety with full memory sharing between threads. Does any other language that doesn't have a global lock, throwing away most of the advantage, have that? There are actual new and interesting advantages to the compile time ownership model.
- pjmlp 4y ago> Rust also uses the same mechanisms to get compile time thread safety with full memory sharing between threads. A minor advantage on the age of microservices and OS IPC to shared external resources. Sendable doesn't apply when those threads are accessing shared external resources.
- agentultra 4y agoBenchmarks vary wildly but Haskell tends to perform in the same realm as C++, fwiw. It's GC'd, uses immutable data structures, and uses a green threading model that can be easily exploited by user code for extreme levels of parallelism with full memory safety. It's even possible to hold mutable references and share them across threads safely with STM (not a global lock). If you want fully lock-free it might be possible to prove that with extensions like Liquid Haskell, via Linear types, and is definitely easier to prove with a theorem prover than it is, generally, for C++ code. Not sure about Rust though I realize quite a lot of its moving parts have already been formalized which is super cool. There are reasons for using Rust but it's not the only game in town. And GC doesn't automatically mean pessimistic performance.