On 3/3/14 4:32 PM, Daniel Micay wrote:
Type-checked lifetimes on references and type-checked move semantics are examples of true safety improvements over C++. They are not a panacea as they prevent expressing many safe patterns, even when the safety is obvious to a human or a more complex type-checking algorithm.
Avoiding the unsafe patterns (such as unsafe pointers, e.g. `this`) is very difficult in C++, however. Nothing is a panacea as far as zero-cost safety is concerned. However, any provably memory-safe subset of C++11 would be even more limiting, as it would rule out any use of methods (except perhaps with `enable_shared_from_this` and use of `shared_ptr` for *all data*).
If you're not familiar with writing in a modern dialect of C++11 with similar idioms to Rust, then I don't think writing articles comparing the languages is fair. Rust doesn't bring anything new to the table when it comes to destructors, allocators or smart pointers. It's still playing catch-up to C++11 and Boost in these areas.
It does enforce that you don't do any unsafe things when using destructors, allocators, or smart pointers without using the *unsafe* keyword, which is an improvement to me.
Patrick _______________________________________________ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev