3 ms·
Memory safety isn't exclusive to Rust. Language designers and implementers solved these problems years ago with safer languages (better type systems, removing p
by shirro 3y ago
Memory safety isn't exclusive to Rust. Language designers and implementers solved these problems years ago with safer languages (better type systems, removing pointers) or safer runtimes (jvm, .net etc). Rust is notable because it brings a lot of prior art together in one place and the compiler prevents most problems at compile time. As long as programmers don't use unsafe Rust it can produce safer code without runtime overhead. There are a lot of safer languages than C. Not all are suitable for writing system libraries.
- WirelessGigabit 3y agoMind you that there is a runtime overhead. If we look at access beyond on a slice's boundary: https://github.com/rust-lang/rust/blob/ea37e8091fe87ae0a7e204c034e7d55061e56790/library/core/src/slice/index.rs#L315-L322 https://github.com/rust-lang/rust/blob/ea37e8091fe87ae0a7e20... This bounds check is what enables Rust code to fail with a panic vs continuing (which is what triggers a lot of bugs). Post about the impact on performance: https://blog.readyset.io/bounds-checks/ https://blog.readyset.io/bounds-checks/