3 ms·
I'd like to reassure you that the Rust community absolutely does not condone wanton usage of `unsafe` unless profiling indicates an area that really requires lo
by kibwen 12y ago
I'd like to reassure you that the Rust community absolutely does not condone wanton usage of `unsafe` unless profiling indicates an area that really requires low-level trickery. The discussion in the article linked here concerns the standard library, which needs to be fast because otherwise people will reimplement it themselves, likely poorly, over and over again. By accepting potential unsafety here we are saving others the effort of a half-baked, insecure collections library while also concentrating our audits on well-known and oft-used code.
> All the major scripting languages are memory-safe.
> Newer hard-compiled languages such as D and Go are memory-safe
Rust's definition of safety actually surpasses most of these languages, as it extends to safety in the face of concurrent operations. Rust statically prevents data races, which AFAIK is a property that until now has only been exhibited by thoroughly immutable languages such as Erlang. That it manages all this without a GC is very exciting.
> Meanwhile, in the security world,
> the buffer overflow threat has become worse.
The Rust developers agree with you. Rust is motivated by the fact that Mozilla is tired of Firefox getting pwned by dint of C++'s looseness, and despairing at the fact that further improvements to Firefox will entail tacking concurrency onto a multi-million-line C++ codebase dating back to 1997, which would be notoriously difficult even if security weren't a concern. They're writing a brand-new browser engine in Servo with a focus on massive concurrency and user safety.
I guarantee you that Rust cares a great deal about safety. It goes to lengths that almost no other language is willing to go in pursuit of this goal. However, it is also a thoroughly pragmatic language. We won't make the world a better place by blindly preaching dogma. Rust also won't be the last language ever made. If nothing else, even baby steps toward a safer world are a measure of progress. :)