3 ms·
> There are no classes, no instances, no inheritance I don't know anything about Elixir, but it bothers me when people claim that languages like Rust and Go ar
by da39a3ee 3y ago
> There are no classes, no instances, no inheritance
I don't know anything about Elixir, but it bothers me when people claim that languages like Rust and Go are "not object oriented". If you create structs and have special syntax for defining functions that operate on instances of those structs, then those are called objects and you are doing OOP. Just because some Java people came up with a definition of OOP that says it has to have inheritance, doesn't mean you actually have to pay attention to their definition.
- lawn 3y agoAnd Erlang (and Elixir) is also closer to the original definition of OOP, with it's focus on message passing between processes ("objects").
- da39a3ee 3y agoRight exactly. The author implies that Elixir isn't an "OOP language" but I agree with you that (AIUI) it's almost the opposite -- it's descended from Erlang whose, AIUI, entire raison d'etre is programming in a style that is strongly oriented around objects (i.e. instances that usually represent entities in the application domain, and communicate by message passing). Immutability is orthogonal.
- ljm 3y agoI mean, I agree as much in that OOP in its classical Alan Kay definition has little to nothing in common with what we currently call OOP. Erlang definitely has more in common with Smalltalk and even Lisp in terms of its architecture and also the ability to modify it at runtime. At least in elixir, state and behaviour aren't intermingled as in Java-style OOP (which PHP, C# and Ruby do mostly)
- deleted 3y ago[deleted]