'method' vs. 'message' vs. 'function' vs. '???'

后端 未结 11 948
北荒
北荒 2020-12-24 12:59

I recently asked a question about what I called \"method calls\". The answer referred to \"messages\". As a self-taught hobby programmer trying to phrase questions that don\

11条回答
  •  既然无缘
    2020-12-24 14:00

    In Object Oriented implementations like C#, the concept of a "message" does not really exist as an explicit language construct. You can't look at a particular bit of code and say "there's the message."

    Instead, a method of an object's class implies the idea that other objects can send a type of message which trigger the behaviour within that method. So you end up just specifying the method directly, rather than sending a message.

    With other implementations like Smalltalk, you can see the message being passed, and the receiving object has the ability to do with that message what it will.

    There are libraries which sit on top of languages such as C# which attempt to restore the explicit message passing feel to the language. I've been cooking up one of my own for fun here: http://collaborateframework.codeplex.com/

提交回复
热议问题