3 ms·
> It is common to use ARC and unsafe shared memory access > in Rust This is false. `Arc` is not common, and when it is used, it is to enable safe shared mem
by kibwen 12y ago
> It is common to use ARC and unsafe shared memory access
> in Rust
This is false. `Arc` is not common, and when it is used, it is to enable safe shared memory access.
> You can't isolate unsafe memory access
This is also false. If you get memory unsafety outside of an `unsafe` block, it is a by definition a bug in the compiler.
- chaotic-good 12y ago> This is also false. If you get memory unsafety outside of an `unsafe` block, it is a by definition a bug in the compiler. All `unsafe` memory access in Rust performed in separate address space? I'm asking because if it isn't - this can't be called `isolated`.
- kibwen 12y agoAh, I thought we were talking about isolation for code auditing purposes. If you're concerned about address space isolation, then this other statement is false: > If somebody needs memory safety - managed languages with > GC is the only real option If I'm in Java, I can call C code via JNI that does whatever garbage I want with the memory of the Java program. There's no isolation there; we are thwarted by the need for FFI. Likewise, `unsafe` in Rust is just a reified FFI: it allows you to do things that Rust doesn't allow you to do, but, crucially, `unsafe` blocks in Rust are still much safer than the C code that you'd otherwise be writing. Thus `unsafe` is a mechanism for making Rust programs safer than they otherwise would be, by avoiding the need to call into C.