4 ms·
Rust (and Go) present an interesting challenge to people who have cargo-culted object-orientation. In Rust, data is dumb, and traits (aka 'interfaces') provide
by stevedonovan 9y ago
Rust (and Go) present an interesting challenge to people who have cargo-culted object-orientation. In Rust, data is dumb, and traits (aka 'interfaces') provide meaning. So you can go polymorphic with 'trait objects' or monomorphic with trait constraints on generics (i.e don't have to pay for virtual dispatch when it matters). The cool thing is that both languages allow interfaces to be _added_ in consuming code, they're not part of the definition as in Java.
- flukus 9y agoYeah I think rust did a really good job of avoiding the worst OO features but keeping the most useful parts. Combining data and logic was the most damaging idea the programming world has had. Once they're separated the code is easier to read, easier to test and easier modify.