top | item 43610579

(no title)

shepmaster | 10 months ago

> [Rust and C++] encourages creating a library of types with inheritance

You'll want to expand on and clarify your meaning here, as Rust does not have inheritance.

discuss

order

Zambyte|10 months ago

Traits encourage the same programming style, regardless of if it's technically inheritance or not.

Arch-TK|10 months ago

I disagree completely.

It's not just a technicality, traits are not the same as multiple inheritance. They allow you to solve the same kinds of problems but traits don't introduce the mountain-loads of confusion, complexity and headache that multiple inheritance does.

Moreover, nothing forces you to use traits. You're just strictly better off using them in many cases. But you can always defer to writing overtly repetitive C style code if you want.