4 ms·
I suppose it depends on how we define "true" message passing.
by igouy 4y ago
I suppose it depends on how we define "true" message passing.
- Rochus 4y agoA general problem of human communication. But there is also a pertinent body of knowledge that is taught and tested at universities, which includes an accepted terminology. The relevant classes in the Smalltalk-80 source code are even called "CompiledMethod" and "MethodDictionary". See also primitivePerformWithArgs, lookupMethodInClass and executeNewMethod in part 4 of the bluebook.
- jecel 4y agoAs a counterpoint, I would suggest looking at Jeff McAffer's CodA project. It defined a group of 7 metaobjects to define the behavior of each object, six of them for message passing and one for accessing state. He couldn't patch the commercial VisualWorks virtual machine and used #doesNotUnderstand: tricks to make his prototype work. It wasn't fast, but showed that the semantics were correct. Here are the message passing metaobjects he defined: - Send: prepares a message to be sent and negotiates with the receiver - Accept: negotiates with the sender - Queue: can save accepted messages to be handled later - Receive: deals with queued messages - Protocol: can associated the selector in a message with executable code - Execution: knows how to used system resources to actually do what the message asked The default metaobjects are 100% compatible with Smalltalk-80 base level code but his thesis show several interesting alternatives.
- Rochus 4y agoThere is no doubt that you can implement a message passing system in Smalltalk, as you can with any Turing complete language. In Smalltalk instead of "calling a virtual method" people just say "sending a message". But it actually works quite similar like e.g. the Java VM. Params and receiver object are evaluated and pushed to the stack, then the method is looked up in the receiver class using the selector (which is an internalized string) and then calls the method with the given parameters (this lookup and call is called "send" in Smalltalk); the major difference is that in Java the verifier checks whether a method with the given name and signature actually exists in the class when it is loaded; but also in Java you can influence the dispatch as you described and e.g. create your own class loader.
- jecel 4y agoWhile you can implement message passing on top of any language, as you said, I was talking about doing message passing under Smalltalk-80. There are non messaging parts in Smalltalk-80, like assignment. The Self variant of Smalltalk goes quite a bit further in using message passing for everything.
- igouy 4y agoWell, if "true" message passing is not what Smalltalk-80 does, how will looking at Smalltalk-80 source code show us what "true" message passing is? Do you mean like Erlang?
- Rochus 4y ago> how will looking at Smalltalk-80 source code show us what "true" message passing is? Not at all; but you can look at the Smalltalk-72 source code. > Do you mean like Erlang? Examples of "true" message passing are e.g. SOAP or MPI. Erlang is an example where message passing is indeed part of the language; another example are Go channels.
- igouy 4y agoMy guess is that very few people care to learn anything about Smalltalk-72, and simply saying you mean something like SOAP or Erlang will clearly communicate what you mean by "true" message passing. If your interest is point-scoring maybe say Smalltalk-80 is simulated message passing or faux message passing ;-)
- coldtea 4y ago>But there is also a pertinent body of knowledge that is taught and tested at universities, which includes an accepted terminology. Well, speaking of universities, can you find a univercity-level course/book that doesn't characterize Smalltalk (post 76 too) as having message passing?