3 ms·
This entire article is about Elixir, not Erlang. Can someone fix the submission title? Also this fits with my experience with Elixir. I can apply all my OOP ba
by skrebbel 10y ago
This entire article is about Elixir, not Erlang. Can someone fix the submission title?
Also this fits with my experience with Elixir. I can apply all my OOP baggage very well in Elixir; one active process maps beautifully one object.
The only thing I miss is a clear _terminology_ distinction between the Elixir versions of an object and a class. Both are called processes, which is a bit messy. Strictly a process is just the runtime thing (the "object") and the "class" is just a function (or, in practice, a module that follows a certain convention). But I've heard many people refer to the latter as "processes" too and I'd love a better word.
- pmontra 10y agoThe class is a module, usually a GenServer. The object is the process spawned from the module. There are no better words because Erlang is born functional and OO is maybe a dirty word in that world. People are starting to accept that it's somewhat object oriented only now. Maybe the next language to use BEAM will use the proper names for the object oriented part of the language. Btw, somebody is trying to make Ruby work on BEAM https://github.com/johnlinvc/erruby https://github.com/johnlinvc/erruby
- masklinn 10y ago> This entire article is about Elixir, not Erlang. Can someone fix the submission title? The article uses Elixir examples, but it is fundamentally about Erlang as that's where the understanding of the concept comes from (through Joe Armstrong), and the examples could just as well have been in Erlang: > There’s one moment in the episode that surprised me. Joe makes a comment about Erlang being “the most object-oriented language.” The same can be said of Elixir. This applies to Elixir through Elixir being a syntactic layer over Erlang, not through anything otherwise intrinsic to Elixir.
- di4na 10y agoSooooo A process is a function running in its own context. A module is just a namespace to group some functions. But there is no real link to what an object brings. At best you could try to compare an OTP behaviour to a class but even that...
- fzzzy 10y agoA process is an object. It accepts messages and sends messages. It encapsulates state.
- di4na 10y agoSure. But... Then you enter the place where you get overloaded semantic. In particular... the fact that "Object need Classes !" or "Objects are a thing that encapsulate Functions with hidden state" I have some ideas for post about the fundamental difference beetween RPC and message passing. And how it impact how you think about your code (Java/Cpp vs Smalltalk/Erlang). I think it is the main point.
- masklinn 10y ago> In particular... the fact that "Object need Classes !" That could hardly be less of a fact though.