3 ms·
Function calls are a special case of messages. They are synchronous. Messages can be synchronous or asynchronous. Reification and distribution are natural fo
by mpweiher 8y ago
Function calls are a special case of messages.
They are synchronous. Messages can be synchronous or asynchronous.
Reification and distribution are natural for messages. For function calls...not so much. Procedure calls, a little closer -> RPCs, OK, but still not really natural, as we have discovered over time.
One big one is that you can actively wait for/receive messages. I am not sure how to map that onto a function or procedure call at all (not: "implement").
Dynamic/late binding again is natural with messages, whereas I am not sure a function call with late binding is still reasonably a function call. Some would say that the fact that the receiver decides how to interpret a message is "declarative", and they have a point, though I am not sure I agree 100%.
Conversely: message sends are the generalisation of function calls.
- dragonwriter 8y ago> Reification and distribution are natural for messages. For function calls...not so much. If you have a way to call functions/methods dynamically by name, and a way to store and pass tuples of arguments when doing so, reifying function/method calls is natural, too.
- mpweiher 8y agoHmm...sounds like a message-send to me?
- CMCDragonkai 8y agoAny object with methods is always waiting on messages. Those methods represent pattern matches on any input message.
- mpweiher 8y agoYep. Conceptually, synchronous message-send is a special-case of asynchronous message-send. Implementation-wise, it's often useful to model it the other way around.