SerenityOS author says Rust is OO-hostile

3 years ago by kixik to c/rust

Web Engines Hackfest 2023 - https://webengineshackfest.org/2023Title: Ladybird: Building a new browser from scratchAuthor: Andreas KlingDate: 05/06/2022Slide...
load all comments
dureuill 2 points 3 years 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.

path: 0 361506, hotness: undefined, score: 2, children: 0
rust
rust

@lemmy.ml

login for more options
9404
398
101

go to feed...