2 ms·
Would it be feasible to create a type which signifies that unsafe computation has happened? Like the IO Monad in Haskell, for example. This type would have to h
by truculent 4y ago
Would it be feasible to create a type which signifies that unsafe computation has happened? Like the IO Monad in Haskell, for example. This type would have to have a constructor that wraps a value and no way to take the value out of the type.
That way, any code “infected” by unsafe computation will also be infected by the type.
- newpavlov 4y agoPractically everything will be marked by it. Using `Vec`? Marked. Reading file? Marked. Printing something to stdout? Marked. The idea behind Rust's unsafe is to cover unsafe bits in safe API which (assuming correctness of the unsafe code) can not be misused to cause memory issues in safe Rust.
- truculent 4y agoGot it, thank you