Send Message Method

BlitzMax Forums/BlitzMax Programming/Send Message Method

Czar Flavius(Posted 2009) [#1]
Objects have defined a method SendMessage:Object(message:Object, context:Object) and as all Types are derived from Object, every Type has this method, which by default simply returns Null. From an OO-theory point of view, I understand why it's there, but I am just wondering if anybody has ever actually made practical use of this method in their project?


Htbaa(Posted 2009) [#2]
I know it's there, but I use my own messaging system for it.


Jesse(Posted 2009) [#3]
Czar, I don't really understand why it's there or how to use it. If you figure out how to use it, Do you mind posting a working example so I can try to understand it? I have wild guesses but it is really beyond my knowledge.


N(Posted 2009) [#4]
I've used it for something similar to [a http://developer.apple.com/mac/library/documentation/cocoa/reference/Foundation/Protocols/NSObject_Protocol/Reference/NSObject.html#//apple_ref/occ/intfm/NSObject/performSelector:withObject:]NSObject performSelector:withObject:[/a]. It's handy when you don't know what the receiver actually does/handles and you need to send messages to differently-typed objects.


Zakk(Posted 2009) [#5]
Isn't SendMessage like an Objective-C thing? I am not very familiar with it.