4 ms·
Imagine that you have three friends helping you with a task. You might give them these instructions: Jack, clean the shelves. Helen, sort the reports.
by jecel 5y ago
Imagine that you have three friends helping you with a task. You might give them these instructions:
Jack, clean the shelves.
Helen, sort the reports.
Lucy, turn on the printer.
You can see that the receiver of each message is the first thing in each line while the message follows it. That is the syntax of imperative expressions in English.
If your name is Kevin and you are the one sending on the messages, where is "Kevin" in the above text? And you sent three messages and yet there is not a single "send" command to be seen.
Here is a less trivial example:
Jack hire a carpenter build cabinet store reports.
This is not valid English, but is a valid Smalltalk-72 expression. A variation which would have the same result is:
((Jack hire a carpenter) build cabinet) store reports.
The first message requests that Jack hire a carpenter. The result of the message is a carpenter who is not named by us, but which we can tell to build a cabinet. The result of this second message is a new cabinet, which we did not name either but which can be asked to store the reports.
So Smalltalk got its syntax from English and that inspired OOP languages that followed.
- dragonwriter 5y ago> If your name is Kevin and you are the one sending on the messages, where is “Kevin” in the above text? It’s not, but if it was radio calls: Jack, this is Kevin, clean the shelves, over. Kevin, this is Jack, wilco, out. Which is analogous to asynchronous message passing on a shared bus; but even then its still (in programming terms) like (using hypothetical syntax): receiver<from:sender>.message(message_data) With typical in-band request-response message sending, there is no need to specify the sender, as a return goes back to the sender implicitly. (And programming platforms that do use asynchronous message passing typically don’t make the sender explicitly identify itself, though the receiver does typically get a handle for the sender to respond to, so it looks something like the above from the receiver side, if not the sender side.)