It’s getting more and more unhinged on LinkedIn.

  • sugar_in_your_tea@sh.itjust.works
    link
    fedilink
    arrow-up
    1
    ·
    3 days ago

    Then how would you define OOP and FP?

    Wikipedia claims it supports OOP:

    Rust does not enforce a programming paradigm, but was influenced by ideas from functional programming, including immutability, higher-order functions, algebraic data types, and pattern matching. It also supports object-oriented programming via structs, enums, traits, and methods.

    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.

    object orientation is classes done wrong

    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.