On 20/08/13 15:19, Oren Ben-Kiki wrote:

I love the compiler-enforced safety wrt. pointer lifetime and ownership, but like all type systems it has its limitations. It seems that the current approach is to implement safe containers with very careful sprinkling of `unsafe` (hey, even std::vec does it!), and then to have the bulk of the code use these safe containers. Maybe you could do something similar.


Note that the iterator-related unsafe in vec is entirely for efficiency, it can easily be implemented manipulating &[] slices directly.

(I'm fairly sure the &mut [] iterator is possible without unsafe, but my experimentation revealed a (possible) bug: https://github.com/mozilla/rust/issues/8636.)


Huon
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to