[Python-ideas] Message passing syntax for objects

Rob Cliffe rob.cliffe at btinternet.com
Mon Mar 18 18:44:00 CET 2013

On 18/03/2013 17:18, Mark Janssen wrote:
>> Ian Cordasco wrote:
>>> On Sun, Mar 17, 2013 at 11:53 PM, Mark Janssen
>>> <dreamingforward at gmail.com> wrote:
>>>> Hello,
>>>> I just posted an answers on quora.com about OOP (http://qr.ae/TM1Vb)
>>>> and wanted to engage the python community on the subject.
>> My answer to that question would be that it *did*
>> catch on, it's just that we changed the terminology.
>> Instead of message passing, we talk about calling
>> methods.
> Yes, but this is where it breaks the OOP abstraction by 90 degrees.
> By using function calls, you're telling the machine to do something.
> But when you want to pass something to an object there should be a
> natural way to do this for every object.  By using methods you pollute
> the concept space with all sorts of semi-random (i.e. personal) names,
> like append, add, enqueue, etc.
> This proposal would not only make a consistent syntax across all
> objects, but train the programmer to *think* modularly in the sense of
> having a community of re-usable object.  I.e. "What should I do if
> another object passes me something?".  No one thinks this now, because
> the programmer expects new developers to learn *their* interface!
> Mark
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
I'm struggling to understand what you mean (and I don't seem to be the 
only one).
As far as I can tell, you would replace an object with N methods by an 
object with one huge method (ProcessReceivedMessage say) which deals 
with N cases.
(Not an improvement as your code has become much less modular.)
And instead of semi-arbitrary method names, you have semi-arbitrary 
messages (names, numbers or whatever).
Just as much of an interface to learn.
Am I missing something?
Can you give a semi-concrete example using pseudo-code, where your way 
clearly does something which can't be done as well (or at all) using 
method calls?
Rob Cliffe

More information about the Python-ideas mailing list