4 ms·
Any Python function may use ctypes, any Haskell function may use unsafePerformIO, ..., so all bets are off all the time. I don't think that's a particularly us
by dbaupp 8y ago
Any Python function may use ctypes, any Haskell function may use unsafePerformIO, ..., so all bets are off all the time.
I don't think that's a particularly useful point, as is.
- lomnakkus 8y agoNot that this "makes the point", necessarily, but GHC Haskell does have the whole Safe/Unsafe Haskell module inference/guarantee, so it may be a bit easier to avoid unexpectedly unsafe behavior entirely. I have no idea whether any equivalent exists for Rust.
- steveklabnik 8y agoRust requires you to to explicitly mark individual blocks of code as unsafe, and you can only do unsafe operations inside of them.
- deleted 8y ago[deleted]
- dbaupp 8y agoThere's not a module-level Safe/Trustworthy/Unsafe division, but as steveklabnik1 says, any potentially-dangerous code has to be placed into an `unsafe` block. One can also forbid the use of any `unsafe` blocks for a crate/module (with the #[forbid(unsafe_code)] attribute), but this is slightly different to the {-# LANGUAGE Safe #-} pragma in that it does consider imports at all. However, since "unsafety" is modeled in the language in Rust, and is granular, people are encouraged to have every module be "Trustworthy" (in Safe Haskell terms): if an individual function could cause undefined behaviour if misused, it should be marked "unsafe", and a "Safe" module (i.e. one using the forbid above) won't be able to use it.