Hi
Regarding Object::sendMsg (and sendMsgWithParams etc.). Something I haven't utilised but I'm sure lots of others may have (in fact I suspect it one of the intended uses of these methods) is to use them in a similar way to passing a delegate to a method in say C#. (My question is at the end of this post.)
In other words if Class1 has a method something like aMethod::(pObject : Object ; pMethod : String)
And we have some other class that has a "delegate" method, say...
Class2::aDelegateMethod(pObject : SomeClass) : Boolean
... and somewhere in code it calls...
aClass1Instance.aMethod(self,"aDelegateMethod")
Then that Class1::aMethod(pObject : Object ; pMethod : String) can do something like...
foreach x in SomeClass.instances do
result := pObject.sendMsgWithIOParams(pMethod,x);
if result then
// do whatever
endif;
endforeach;
In other words this method is calling a "delegate" method of the calling object (sorry, my terminology doesn't quite sound right).
In terms of result, it's kind of similar to what I'd do quite a lot in C#, but my question is... given the method name is passed as a string (unlike passing a C# delegate that is strongly-typed) there must be some kind of reflection going on, and in a loop like that I am wondering about overhead (how significant would it be). And to some extent I'm asking, is this whole methodology a bad idea or something that is in fact widely used by others?
Cheers
David