Maybe Erlang is OO after all?
Fri Aug 22 18:53:28 CEST 2003
Joe Armstrong wrote:
> I have been reliably informed that maybe Erlang *is* OO after all.
> The argument goes like this:
> The two most important things in OO reasoning are:
> - isolation, and, - polymorphism
> All the other stuff - inheritance etc pales into insignificance in
That's not the majority opinion in the OO arena.
More importantly, one of the key points in making OO practical is that
calling a polymorphic function is very little overhead over calling a
monomorphic one. I don't see this happen in Erlang: sending an
asynchronous message is, after all, *much* more overhead than doing a
subroutine call, even if that call goes through a dispatch table.
You'll probably consider that overhead negligible, but that's only
because you don't do serious data moving through messages. You're not
going to write a separate process for doing arithmetic with complex
numbers, string processing, or similar basic tasks - OO languages do a
dynamic dispatch on these (or *should* do it...)
In other words, claiming OO for Erlang is a bit like claiming
functionalness for C - yes you *can* do it, but it's not practical...
> Isolation is needed to implement true objects - they *must* be
> isolated processes are a very good approximation to true objects
> (in as much as two Erlang processes are fairly well isolated)
> We can easily set-up polymorphic protocols to processes and write
> polymorphic functions (like lists:sort) - why is polymorphism so
> nice it make programming so much easier - all objects obey the same
> protocol (at some level of abstraction).
> Thus it might be argued that:
> - Erlang *is* OO and
> - Erlang is *more* OO than any of the other so called OO languages
Actually, the "most OO" language that I know is Smalltalk, which does
dynamic dispatch on *everything*, including integer arithmetic.
Also, I don't see much gain in claiming OO-ness for Erlang. The OO hype
is the Cobol of the last and (as it seems) current decade.
The one lasting value of OO that I see is its insistence on isolation.
The polymorphism aspects of OO are far overrated, and tend to leave type
holes in murky areas of the language specification. (The bad thing is
that these type holes tend to go unnoticed for three to fifteen years,
depending on how much polymorphic type theory the language designer has
under the hood - and there's usually a deficit there.)
Just my 2c.
More information about the erlang-questions