Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The important distinction is cause vs effect.

Only code in unsafe blocks can cause unsafety (ignoring already and yet to be discovered soundness bugs in the compiler [1]). But the effect can easily materialize in any location that uses the unsafe code, or types that go through it.

To me this is somewhat obvious, but it's true that this is easily overlooked and should be communicated.

To express this better in the type system, Rust would need an effect system.

[1] https://github.com/rust-lang/rust/issues?q=is%3Aopen+is%3Ais...



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: