News for hackers. Stuff that matters.
Re:Alan Kay on the Meaning of “Object-Oriented Programming” ... by chrisseaton on Sunday March 17, 2019 @10:17PM (#19418238)
I don't know what to say - that just sounds like normal method calls to me. Why do we need the term 'message passing' on top of that, which seems to additionally confuse people around synchronous or not?
Re:Alan Kay on the Meaning of “Object-Oriented Programming” ... by ridiculous_fish on Monday March 18, 2019 @02:31AM (#19419075)
To make this concrete, here are some things you might like to do with normal method calls, but cannot:

1. Make a logging proxy that wraps an arbitrary object. Any method you call on the logger, it logs the name of the method, and then invokes that method on its wrapped object.

2. Make a "tee" object. Any method you call on the object, it invokes on its N child objects.

3. Make a "replay" object. Any method you call on the object, it saves instead of executes. Later you can replay the saved method calls by redirecting them onto another object.

Message sends can invoke a method, but they can also go beyond that.

Re:Alan Kay on the Meaning of “Object-Oriented Programming” ... by galaxyLogic on Sunday March 17, 2019 @11:09PM (#19418429)
Consider JavaScript's "call" if you are familiar with that:

You say somefunk.call (someObject, ...someArgs)

The function executes in the context of 'someObject' meaning it can read and write its fields with expressions like 'this.color = "blue"'.

You could say that somefunk() is a method and you are making a method-call. But it is not a method of 'someObject'. Yet by calling it you CAN manipulate the fields of someObject.

JavaScript is NOT the type of "Message passing/Object-Oriented" system like Smalltalk-80. You can communicate with objects, meaning share information with them, meaning read and write their fields, by means other than their methods only.

Re:Alan Kay on the Meaning of “Object-Oriented Programming” ... by gambler on Monday March 18, 2019 @10:50AM (#19421492)
FFS, this isn't that hard to understand. What is your language background?

The core difference is that messages are interpreted by the object itself. At runtime.

Here is a practical example where the difference is obvious. Let's say you have an object that does business logic. You want to log all of its operations without changing its logic or the code that calls it.

In a method call language, this is a pain in the ass. You have to subclass the original class, override every single method, and call the original logic + logger in every single one of those methods. And after all that work all you get is a lousy logger that's just good for one class and needs to be modified if you add something to the original class.

In a message-passing language, you would create a proxy class that passes all of its messages to the original object, then calls the logger. This implementation would involve writing only one method and would be applicable to absolutely any class/object in the system.

And this is just one out of many, many instances where message-passing allows for elegant solutions while method calls make you miserable.

Re:Alan Kay on the Meaning of “Object-Oriented Programming” ... by igouy on Monday March 18, 2019 @12:08AM (#19418630)
For some definition "normal method calls" :-)

Obviously it is a definition of normal method calls in Smalltalk.

Even with Smalltalk, he well or poorly do you think setters/getters fit within that description?