Ian Bicking: the old part of his blog

Objects, Messages, Erlang

Sometimes in the Smalltalk world they like to talk about messages. Alan Kay has said that he wished he had talked more about messages and less about "object oriented programming."

In contrast curmudgeonly procedural programmers like to talk about how objects are really just procedures with vtables. This is made somewhat more obvious in Python where the self parameter is made explicit. But it's the same in every late-bound OO language.

And anyway, if it's about messages and not objects, what difference does that really make? You send messages to objects, so the distinction seems academic. Unless there's some alternative, messages without objects, to make the distinction less than academic.

That's when I thought about Erlang. Instead of objects, Erland has processes, and you send messages between processes. It seems obvious, but when I'd looked at Erlang before the parallel hadn't occurred to me. In that light Erlang processes make much more sense to me. I should look at it again with fresh eyes.

Created 27 Jan '05


"""And anyway, if it's about messages and not objects, what difference does that really make?"""

It changes how you think about it. The whole point of OO is to bind state to behaviour so you can ignore state and work solely in terms of behaviour. If you think in messages, you're thinking about behaviour - the sender's needs. If you think in objects, you're going to end up thinking too much in terms of implementation - the recipient's needs. The first mindset gives rise to dynamic typing, polymorphism, delegation, and the whole "tell, don't ask" philosophy. The second encourages the reverse. To answer by another question, put yourself in the program's position and ask: "Who's in charge of this cockamamie system anyway? The boss? Or the workers?"

# has

Isn't Stackless (http://stackless.com) kind of putting Erlang's concurrency into Python. The whole idea of not using system threads, but in a language transparent way, being able to send messages to other thread/tasklets, or wait on some result from another thread.

Its too bad that stackless is whitering, I really think its addition to the main python tree would be a great boon that is transparent to the existing language. For one thing, the python community could stop wasting time on the state machine part of Twisted, which is pretty ugly.

# mathieu