4 ms·
Calling external code is a separate issue. This is about unsafe code within the language.
by Animats 12y ago
Calling external code is a separate issue. This is about unsafe code within the language.
- dbaupp 12y agoI thought it was about buffer overflows and security vulnerabilities within Rust programs? i.e. not just the parts written directly in Rust. Looking at anything else seems a bit silly, since the thing that runs in the real world is the whole program. The low-level code has to exist somewhere, vectors need to be allocated, strings need to be printed, and people will want the performance. This code is either going to be in external libs called via FFI, as raw codegen in the compiler or in Rust. The last sounds like the one that is safest since the FFI code would have to be written in one of the unsafe systems languages, while writing in Rust gives all the type system advantages and high-level features (references, pattern matching), not to mention avoiding the (mental) overhead of correctly interacting between languages. It seems to me that taking away the low-level power of opt-in `unsafe` is just myopically punting the problem along, rather than seeing it as giving Rust the ability to avoid having to write really unsafe C plugins (like Python etc.).
- kibwen 12y agoBut they aren't separate issues. If you couldn't do these things in Rust, people would just drop into C to do them. Given that that would introduce much more unsafety into Rust programs, Rust does the right thing by reifying unsafe memory operations and sequestering them away.