• Louis Dureuil
    link
    fedilink
    English
    11 year ago

    OO programming is such an overloaded concept that the answer here is “kinda”.

    Rust does make some patterns like the “sea of pointers” of OO languages a bit difficult (mostly due to borrow checking). It also doesn’t feature data inheritance.

    However, rust promotes a style of programming where encapsulation is key (notably to provide safe APIs around unsafe parts), and while the encapsulation unit is the module arguably structs with invariants are still “objects”, in that in code that emphasizes maintainability you don’t interact with their data directly but through their methods, this bundling data with behaviour. It also features static polymorphism through generics and trait, and dynamic polymorphism through either enums or through trait objects.

    My personal take away is that rust has OOP, the good parts.