by fetbaffe · 7y ago · 0 comments
Definition of OOP has changed over the years, early on it was a lot of focus on inheritance & polymorphism, but today it is mostly about composition, which is basically what you do in FP as well.
New inventive ideas like Go's & Typescript's interfaces flips the relationship between the caller & the callee. Or Rust's traits where you can expand your existing types with new behavior.
There is criticism about OOP to be said, but using Java as your strawman to invalidate OOP is not really a good argument, it is just one implementation of many.
Edit: removed the word dynamically from description about Rust traits.
Rust is not referentially transparent, does not model effects (any function can rm -Rf your drive), permits shared mutable state (RefCell, etc) includes statements not just expressions (break, return). Its most important safeguard is its affine type system, which is absent from Haskell.
Item declarations, let statements, expression statements, and macro invocation statements are the four kinds of statements in Rust.
Java has added more & more FP style constructs, does it make Java a FP language?