News for hackers. Stuff that matters.
Re:Rust: Enable WebAssembly backend by default by jeffdavis on Sunday November 26, 2017 @03:05PM (#15782700)
I think it's wrong to say that unsafe blocks "contain" the unsafety. Unsafety can't really be contained once it's there -- that's what makes it unsafe.

The advantage is that you should be able to write application code without unsafe blocks; they should be in a library. And the library has a contract: if unsafe behavior does leak outside the library, it is clearly the fault of the library, and can't be blamed on the (safe) caller.

Re:Rust: Enable WebAssembly backend by default by TheDong on Sunday November 26, 2017 @03:08PM (#15782715)
Unsafe blocks "contain the possible sources of unsafety" may be a more correct way to phrase it.

It is better to know that only a specific subset of the codebase could be responsible for memory unsafety even if that behavior may leak. If nothing else, it helps focus reviewing and testing effort.

Re:Rust: Enable WebAssembly backend by default by burntsushi on Sunday November 26, 2017 @03:20PM (#15782768)
I'm pretty sure y'all are saying the same thing. :-) my favorite way of describing it is "Rust lets you build safe abstractions, even if its core uses unsafe."