5 ms·
Nah. It's about objects. Messaging is when you send a message off to the vasty deep and hope for a reply. A Smalltalk message is a function call that has to ret
by Animats 7y ago
Nah. It's about objects. Messaging is when you send a message off to the vasty deep and hope for a reply. A Smalltalk message is a function call that has to return.
Most of the issues around messaging come from waiting for answers. Hence callbacks, futures, async, retries, timeouts...
Good discussion of this back in 2012.[1]
[1] https://news.ycombinator.com/item?id=4788926 https://news.ycombinator.com/item?id=4788926
- lonelappde 7y agoI think Alan Kay knows what Smalltalk is about. He uses messaging to mean interfaces and protocols of communication.
- Animats 7y agoRanks of "Message oriented": Rank 1: Polymorphism. You can "send" a message to an object. You don't know or care exactly what the object does. Other than the polymorphism, the "message" behaves just like a function call. It will definitely be handled by your target object, and it will definitely return instantly with a response. The compiler might even be able to inline this function call. As seen in: Pretty much every OOP language. Rank 2: Messages as first-class values. It's possible to write a function that forwards all incoming messages to another object, based on some logic. The caller does not know what will happen to the message. However, the message can be expected to be handled instantly, and it may respond instantly (if it does have a response). As seen in: Objective-C, Smalltalk Rank 3: Asynchronous messaging. When sending an outgoing message, it might be placed in a queue and handled at a later date. The message does not return a result instantly, so agents must have some other mechanism (such as including a "reply to" address) to be able to talk back and forth. From the perspective of the caller, it's a bit like putting a message in a bottle and watching it drift off to sea. As seen in: Erlang, message queueing libraries.[1] “When I use a word,” Humpty Dumpty said, in rather a scornful tone, “it means just what I choose it to mean—neither more nor less.” “The question is,” said Alice, “whether you can make words mean so many different things.” “The question is,” said Humpty Dumpty, “which is to be master—that’s all.” [1] https://news.ycombinator.com/item?id=4788926 https://news.ycombinator.com/item?id=4788926
- nikki93 7y agoThere may be forms of messaging where the "medium" surrounding messages is more like an aether -- sorta like photons in space. And the addressing to objects super loose. I don't think it needs to be so strongly receiver-bound.
- galaxyLogic 7y ago> Rank 3: Asynchronous messaging. When sending an outgoing message, it might be placed in a queue Arguments of a Smalltalk message can be "blocks" which are function-like objects. The receiver of a message carrying a block as argument can put the block into a list/queue and evaluate it any time in the future. So that would seem to qualify as "asynchronous messaging" to me.
- inopinatus 7y agoBlocks are closures, so they are bound to the sender's environment. If we accept the definition given above they'd thereby fail the "message in a bottle" test.
- galaxyLogic 7y agoNot sure what exactly is the "message in a bottle" -test and why would we need one? I think it is a limitation of "bottle-mail" that you can not easily reply to the message. Of course sometimes all you have is a bottle and a piece of paper and the sea around you :-)
- jakear 7y agoWould Proxy objects in JS be an example of Rank 2? And a proxy object that returns promises an example of Rank 3?
- streetcat1 7y agoI would stipulate that go channels are closer than erlang. I.e. Erlang is actors, and actors are CSP. Go does CSP directly.
- galaxyLogic 7y ago> A Smalltalk message is a function call that has to return. Yes, but, that does not mean "async messaging" is not supported. A Smalltalk "message" can return "nil" immediately in other words return nothing. A message-argument can be a "block" which is an executable function-like object, in fact very close to JavaScript function-closures. So the recipient of a message carrying a block can at any time in the future ask the block to execute itself, with arguments, and thus produce async "replies", again much like with JavaScript "callbacks". The arguments of a block can be blocks as well thus providing multi-way message passing. What Smalltalk does not support out of the box is Distributed Programming, i.e. multiple machines communicating and working together passing messages among themselves. You will have to create your own servers and communications protocols to do that.