[Python-ideas] Message passing syntax for objects

Andrew Barnert abarnert at yahoo.com
Mon Mar 18 22:26:07 CET 2013

From: Mark Janssen <dreamingforward at gmail.com>

Sent: Monday, March 18, 2013 1:42 PM
>>  OK, let's use your own example, which you keep reiterating:
>>>>>  42 >> MyCollectionType  #would add the object into your 
> collection:  *poof*: no more random syntaxiis for putting things in 
> collections.\
>>  This solves the problem that list.append, set.add, etc. all look completely 
> different. Great.
>>  But what if I want to extend instead of appending? 

> All that is very good analysis.  However, these data types you talk
> about, I'm gong to argue are explorations from the journey of computer
> *science* which are suboptimal.

I chose these data types because they were your own example.

> But to say suboptimal I have to

> suggest the context in which I'm optimizing.  That context is creating
> the idea of a data universe and ecosystem where the ideals of OOP and
> re-usability come out of dreamland and into reality.  And the only way
> to do that is to start at the *bottom* and work upwards.  That is to
> define the fundamental unit, to re-evalutate the fundamental Object.
> But to figure out that you need also the fundamental communications
> pathway -- how those fundamental objects will interact.
> The questions for this data universe can be boiled down to only a few:
> what event necessitates the object/node creation?  What is the
> relationship *between* objects?

OK, so "computer science" data types like lists, and integers (as things you can perform both multiplication and addition on), are not fundamental. What is fundamental?

Anyone who knows any mathematical logic can answer this. For example, give me the empty set and a handful of fundamental operations, and I can give you integers (starting with Peano arithmetic) and lists (starting with ordered pairs). Or, give me relations and a handful of fundamental operations. Or…

The problem here is that "handful of fundamental operations". You want just _one_ fundamental binary operation. Well, even that's possible. In fact, you can use the X combinator as both your basic value and your one basic operation.

Even if you _do_ reduce everything to the X combinator, that still doesn't explain how "42 >> mycollection" fails to be ambiguous. There are multiple ways you can model integers and collections that are all perfectly sensible, one of which will make "42 >> mylist" append 42 to the end of the list, one of which will make "42 >> mylist" append to the start, and one of which will make "42 >> mylist" insert the next argument to come in at position 42. Which one of these is "right"? And, if you don't like that type (which, again, was your suggestion), pick any other type that anyone might ever want to deal with.

And this goes back to the same fundamental misconception that I pointed out in the last email, that you skipped over. Smalltalk and Simula, and their descendants, and relational databases, and semantic web initiatives, and so on all have some concept of structure to their messages. This is what allows the same object to do more than one thing. That's why they can model fields and sequences, cars and phones, web services and documents, etc. That's why they're useful.

Finally, if you want to design a whole new language from the ground up, whether on top of the X combinator or ER models or RDF+RIF or whatever, with a completely different model from Python and a completely different syntax… why would you post about it on python-ideas?

More information about the Python-ideas mailing list