[erlang-questions] mutable state
Mon May 12 06:59:24 CEST 2014
On second thought, the obvious and natural way to model
objects in Erlang is as processes.
An object executes
loop(Var1, Var2, ..., Varn) ->
do some stuff,
loop(Var1', Var2', ..., Varn')
This is pretty much what Hewitt's actors did, and pretty much
what an early version of Smalltalk did.
You get objects with identity and state; you get synchronous
and asynchronous message sends; you get *distributed* objects.
The one thing you do not get is classes, although delegation is
easy to arrange.
However, inheritance is simply a way of *writing* OO programs;
there doesn't have to be anything analogous to inheritance
happening at run time.
(Come to think of it, you *could* have classes and inheritance.)
More information about the erlang-questions