Meyer, OO and concurrency
Thu Jul 14 21:03:55 CEST 2005
Den 2005-07-14 18:23:42 skrev David Hopwood
> Peter-Henry Mander wrote:
> Hi Gurus,
> Sorry but I've got to stick my oar in.
> I've found that modelling a OO system in Erlang recovers the original
> concept of objects as concurrent actors.
> Almost, but:
> - Erlang does not garbage-collect processes when they are waiting
> unconditionally for a message that can never be sent.
This was discussed recently in comp.lang.functional and
some other newsgroups. I think what came out of the discussion
was that a process never becomes unreachable in Erlang, and
thus, there is no way to determine that a process is waiting
in vain. Besides, I believe that it's quite beneficial for
debugging that a hanging process isn't automatically removed
before anyone has a chance to inspect it.
> - Erlang Pids are forgeable, and it is possible to enumerate
> the Pids of all processes (which was prohibited in actor
... part of the reason why processes are always reachable.
Also a great feature during debugging.
> - processes in Erlang implementations, although they are more
> lightweight than threads, are still a bit too heavyweight to be
> used in the same way as objects.
Agreed. This is one reason why mapping OOD to Erlang is not
such a great idea. For different types of object, you need to
choose different implementations in Erlang. Every type of
object can't reasonably be mapped onto a process.
More information about the erlang-questions