At first, I suggested that “messages” were just a different name for method calls,
Yes and no. Messages are Smalltalk and Objective-C terms for method calls. The fact is that not only the terminology is different, but also the real implementation. There are 8 different possible combinations to match terminology, syntax, and implementation, for example:
+-------------------+----------------------+--------------------+ | terminology | syntax | implementation | +-------------------+----------------------+--------------------+ | "method call" | Simula (o.method()) | static binding | non-virtual C++ methods +-------------------+----------------------+--------------------+ | "method call" | Simula | dynamic binding | +-------------------+----------------------+--------------------+ | "method call" | Smalltalk ([o meth]) | static binding | +-------------------+----------------------+--------------------+ | "method call" | Smalltalk | dynamic binding | +-------------------+----------------------+--------------------+ | "message passing" | Simula | static binding | +-------------------+----------------------+--------------------+ | "message passing" | Simula | dynamic binding | +-------------------+----------------------+--------------------+ | "message passing" | Smalltalk | static binding | +-------------------+----------------------+--------------------+ | "message passing" | Smalltalk | dynamic binding | Objective-C +-------------------+----------------------+--------------------+
The combination that the language designer chooses is simply a matter of taste.
I'm still not sure why the language developers chose a messaging system in a more direct call system
Since it has some advantages, such as interposition and introspection of runtime, you can query and change the behavior of classes, methods, and objects at runtime. In the implementation of Objective-C, this was done in such a way that it is very cheap, it has almost no overhead.
user529758
source share