[Python-ideas] Message passing syntax for objects

Mark Janssen dreamingforward at gmail.com
Mon Mar 18 19:22:29 CET 2013


On Mon, Mar 18, 2013 at 10:47 AM, Ethan Furman <ethan at stoneleaf.us> wrote:
> On 03/18/2013 10:36 AM, Mark Janssen wrote:
>>
>> No more having to learn each programers interface for passing
>> interacting with the object.  The >> and << syntax now becomes the de
>> facto way for object interaction across all objects.  Class design
>> will revolve around this fact.
>
> We need a concrete example.  Let's do `int`s.  Currently, a small subset of
> the things we can do with ints includes multiplying, dividing, adding,
> subtracting, and (formatted) displaying -- how would these operations look
> with a message passing inteface?

Good.  You've chosen perhaps the worst example to demonstrate the
point, but let's see if I can turn it into an opportunity (haha).

I suggest that the mathematical domain is completely separate from
what most people do with computers and with programming.  The term
"computers" is a misnomer, and is misinforming the power that the
computer as an *abstraction* provides.  Keep in mind that there aren't
really 1's and 0's moving around in the machine.  In the machine,
there are only *states* (which could *any* differentiable "thing",
like "happy face" "sad face").  We've just come to symbolize them with
numbers because of their history of calculation.

Let's examine arithmetic for a moment.  Ultimately, arithmetic can be
done with simple + and - operators (multiplication simply by repeating
addition, etc).  If you allow negative numbers you really only need
the ONE operator.  Now, I think numbers are the only domain where the
more standard (current) interface should be preserved, but yet, as
I've shown, the message or data-passing interface can accommodate
arithmetic if purity is desired, it's just that for real math, it
won't be as efficient.

But that's okay, because really, what we're generally doing (i mean
the computers) these days is manipulating *symbols* or "objects".
Most of the time that is what we're doing -- not arithmetic, except in
some very simple ways which I will try to elucidate.  So, *if* that is
the case, then the language should develop a *construct* in which to
standardize this fact.

So, if our domain is "objects" more than number (which is a pretty
concrete thing), then, in what ways do (or should) numbers and
data/symbols/objects interact within the programming domain or
environment?  As you know from C, most interaction with number *as a
language construct* was fairly limited:  incrementing a loop, for
example.   In fact C invented the unit increment as a syntactical
element.  I think this is the more valid way of examining an interface
into number as a linguistic construction.

But as I told another poster, I will examine the standard library and
come up with some good examples of how a standardized data passing
interface will benefit the programmer.

Mark



More information about the Python-ideas mailing list