Hacker News new | past | comments | ask | show | jobs | submit login

OOP and FP are really not all that different anymore. I joke it's become like risc/cisc: OOPLs (including python) these days have lambdas, map, and reduce... Elixir has inheritance (behaviours) and polymorphism (protocols).

What elixir doesn't have is pass-by-reference. Which, imho, is a huge win, unless you are going matrix math.




Polymorphism is not an OOP concept. Behaviors are like interfaces, not inheritance. Behaviors allow dynamic dispatch but let's not try to fit OOP where it doesn't belong.

When people talk about how similar are OOP and FP languages they miss the elephant in the room - immutability.


Maybe my PL history is wrong, but weren't interfaces made popular by java as a way to avoid C++ - style problems with multiple inheritance?

> When people talk about how similar are OOP and FP languages they miss the elephant in the room - immutability.

>> What elixir doesn't have is pass-by-reference

But immutability is not INHERENT to the FP style. In the strictest sense BEAM languages are not immutable, because message-passing is not state-safe, and there's also the Process library (and NIFs), but practically they are. Julia is also a very powerful FP language that isn't immutable by default, and Swift is an OO-ish? is it OO? language that is pass-by-value by default.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: