Re:Getting Past C
by sidlls on Tuesday January 03, 2017 @06:37PM
(#13314352)
Let me clarify: in Rust it is trivial to use memory unsafely. It is not, so far as I have found, trivial to hide that fact because it is required to use "unsafe" syntax decoration" to do so.
[ Parent
| on HN ]
Re:Getting Past C
by Manishearth on Tuesday January 03, 2017 @06:45PM
(#13314396)
The issue here is that that definition of "safe" language basically excludes all practical languages, including languages like Python, because FFI is possible.
In general when talking about safety in a language it's about the level of explicitness required to trigger unsafety.
I like the distinction made in the nomicon (https://doc.rust-lang.org/stable/nomicon/meet-safe-and-unsaf...) -- Rust comprises of two distinct languages. You have everyday Rust, which is completely memory safe, and "unsafe Rust", which looks similar to everyday Rust but is not safe. `unsafe {}` blocks are your FFI between the two. Looking at unsafe blocks as FFI is IMO a very useful mental model especially for understanding the changes to invariants involved.