4 ms·
An actor in Erlang is not an object, but a (usually recursive) function where receive is called in each recursion. It's stateful in the sense that Haskell funct
by danieldk 12y ago
An actor in Erlang is not an object, but a (usually recursive) function where receive is called in each recursion. It's stateful in the sense that Haskell functions are stateful: you pass a new state as an argument to the next function.
- tormeh 12y agoSame same, but different.
- djur 12y agoActors and objects are closely related. Erlang processes provide encapsulation, the indefinite recursion allows maintaining local state, and dynamic dispatch is provided directly by the programmer or by behaviors.
- rdtsc 12y ago> An actor in Erlang is not an object And function with closure and/or with a state passed through and it is an as good as an object. Heck, look at one of the most popular languages -- Python. Method calls look nice an explicit like def method(self,...). Others have self too (usually called "this"), but it appears there implicitly. At the memory level Erlang actors are even better objects because they actually enforce memory isolation. Which is in spirit with Alan Kay's original OO idea.
- danieldk 12y agoHeck, look at one of the most popular languages -- Python. Method calls look nice an explicit like def method(self,...). Others have self too (usually called "this"), but it appears there implicitly. "Foolish pupil - objects are merely a poor man's closures." And visa versa. However, this line of reasoning definitely differs from what one nowadays considers an object-oriented language. Which was exactly what this article was about.