this post was submitted on 25 Mar 2025
196 points (97.6% liked)
Rust
6712 readers
31 users here now
Welcome to the Rust community! This is a place to discuss about the Rust programming language.
Wormhole
Credits
- The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Then how would you define OOP and FP?
Wikipedia claims it supports OOP:
I wouldn't say Rust is an OOP language though, because that absolutely gives the wrong impression since that evokes ideas of classical inheritance as in C++ or Java. But I do very much believe it supports object oriented programming as a paradigm, since you can model things with objects at the core.
That said, I think Rust is best used with less emphasis on OOP, since it's pretty easy to get into trouble modeling things that way when it comes to lifetimes. I use OOP-style in Rust when it makes sense, and the rest is as close to functional as I can get it.
I think classical inheritance is object oriented programming done wrong. Go had the start of a good idea with composition and interfaces, and I think Rust's traits + generics improved on it.