Skip Navigation

SerenityOS author says Rust is OO-hostile

cross-posted from: https://lemmy.one/post/123519

Skip to around 24m:00s

6
General Programming Discussion @lemmy.ml xoner3 @lemmy.one

SerenityOS author says Rust is OO-hostile

6 3

You're viewing a single thread.

6 comments
  • 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.

6 comments