3 ms·
> "Giving programmers low-level tools when they need them" as an excuse for abandoning language safety is a recipe for bad code. There's a long, long history of
by dbaupp 12y ago
> "Giving programmers low-level tools when they need them" as an excuse for abandoning language safety is a recipe for bad code. There's a long, long history of that not working. "Unsafe" code should be very, very rare, used for dealing with device registers and such.
How does Rust get an efficient vector type? How does it spawn a thread? How does it print something, or write something to file?
All of these need really low-level code e.g. for interacting with the operating system APIs, or handling possibly-uninitialised data.
Rust explicitly segregates `unsafe`, and we try to instil a strong aversion to using it exactly because it is dangerous and very easy to get wrong, but it's just not reasonable to remove that ability.