[Python-ideas] Message passing syntax for objects

Benjamin Kaplan benjamin.kaplan at case.edu
Mon Mar 18 21:34:01 CET 2013


On Mon, Mar 18, 2013 at 1:24 PM, Mark Janssen <dreamingforward at gmail.com> wrote:
> On Mon, Mar 18, 2013 at 12:06 PM, Georg Brandl <g.brandl at gmx.net> wrote:
>> Am 18.03.2013 05:26, schrieb Mark Janssen:
>>> Continuing on this thread, there would be a new bunch of behaviors to
>>> be defined.  Since "everything is an object", there can now be a
>>> standard way to define the *next* common abstraction of "every object
>>> interacts with other objects".
>>
>> The problem is that for most objects there isn't *the* interaction.  Sure,
>> you could split up complicated objects into small pieces with a smaller
>> functionality, but at some point you have to stop.
>
> Yes.  But that is the point, if you look at the quora post -- to
> invert the object model and create mashups of simple modular data
> types and working *upwards*.
>
>>  Let's see how this
>> concept fares with simple types such as integers or collections...
>>
>>>>>> 42 >> MyNumberType #would add the integer to your integer type
>>
>> That's just random.  Why not multiply?  Why not exponentiate?
>
> Well, as I noted in another post, that while these can be broken down
> into their simpler component (addition and negative numbers), numbers
> should probably be treated separately.
>
>>>>>> 42 >> MyCollectionType  #would add the object into your collection:
>>>  *poof*: no more random syntaxiis for putting things in collections.\
>>
>> So you've replaced one method of a collections API by your magical operator,
>> for all collections.
>
> Yes -- for all collections.  That's a pretty big gain right?
>

Nope. No gain at all. Instead of learning the add() method, you learn
the >> operator. You have not simplified anything.
>> It seems that you are reinventing pipes (such as UNIX shell pipes).
>
> That is a very interesting comparison.  That is something like what
> I'm trying to do.  In tandem with the Internet, I do see a kind of
> synthesis of Web + O.S. integration -- ultimately, creating a "data
> ecosystem".
>
> mark

Yes, having the whole program run by chaining functions together is a
neat idea. And it works great in functional languages- if you want
that as a feature, use OCaml or Haskell. It works less well in
imperative languages where you are manipulating data, not just passing
it around.

> --
> http://mail.python.org/mailman/listinfo/python-list



More information about the Python-list mailing list