| ▲ | Animats 3 hours ago | |
Yes. The polymorphism isn't bad. It's the inheritance of data that's the problem. Rust traits can't have associated data. That's the big difference from objects. It's also hard to have a parent-child relationship where the child can find the parent. That takes much fooling around with wordy combos of Rc, Weak, upgrade, etc. This makes it hard to convert C++ programs, and C++ programmers, to Rust. It's quite possible to write 100% safe code under Rust's constraints, but it takes a major rethink from C++. | ||