3 ms·
Sending a message does not necessarily call a method (especially not the one indicated by the name, messages to nil do nothing, ...), and you can call methods w
by mpweiher 13y ago
Sending a message does not necessarily call a method (especially not the one indicated by the name, messages to nil do nothing, ...), and you can call methods without going through the messenger (get the IMP, call it).
Yes they are similar, and most often sending a message of a particular name will invoke a method of that name via the messenger. But they are different in ways that matter, so it is better to use the correct terminology.
However, it's not really a big deal, you will typically be understood either way. However, I don't quite understand why using the correct terminology is so difficult. "Send a message" vs. "Call a method". Same number of words, same number of syllables. OK, 1 letter more to type...
- vor_ 13y agoThere's nothing difficult about it. It's just a pedantic and pointless distinction most of the time. To be more specific about what I was referring to, some folks on the Objective-C mailing list didn't even want methods in a protocol to be called methods. Instead they are to be called "method signatures". I roll my eyes.
- mpweiher 13y agoWell, maybe that's because they aren't actually methods? A method is an implementation, something that executes. Protocols do not contain implementations, though there have been proposals to actually add methods to protocols. Talking about such a proposal to add methods to protocols becomes difficult when you have called the messages that are already there methods...