2 ms·
I think about conceptually like this... When one object is "calling a function" inside of another object, it's reaching into that object, grabbing the method i
by adamwathan 11y ago
I think about conceptually like this...
When one object is "calling a function" inside of another object, it's reaching into that object, grabbing the method it wants to invoke, and invoking it. It puts the responsibility of invoking that method on the caller.
When one object "sends a message" to another object, the receiving object is responsible for determining what function gets invoked.
The most obvious place this difference manifests itself is the existence of things like "method_missing". That can't happen when you're "calling a function", but if you're just sending a message and the receiving object doesn't have a method that matches the message name, it can still make a decision about how to respond.