What does "Rust & OOP" mean to you?

To me Rust is not an OO language. It can achieve many similar things, sometimes using analogous concepts, but looking at Rust from OOP lens gives weird and distorted picture.

Traits and interfaces are kinda similar (if only they were called Copyable & Cloneable ;)), but trait inheritance is not really OO inheritance in any useful sense. Struct + impl is kinda like a class, and it's nice to have a method syntax and a bit of encapsulation, but it's going to disappoint fans of GoF Programming Patterns.

Traits and type inference create a new kind of polymorphism not limited to objects, but over any types used anywhere.

For me OOP is strictly "hierarchical" in nature, and Rust is "flat". It works better for me to treat Rust as C with lots of syntax sugar, rather than as Java with broken inheritance.

5 Likes