Although there is a documentation available, I got more confused, rather then enlightened. Let's consider an example:
I have a myObject instance, which has myMethod method and I call it from the lobby:
myObject myMethod
In this method's body following is done:
myObject1 anotherMethod //1
msg := message(anotherMethod)
myObject2 do(msg) //2
myObject3 doMessage(msg) //3
So, could anyone explain me differences between 1 2 and 3?
Who is the actual caller for these cases? The locals object of the method, the method object or myObject? Is there a difference between sender and caller (I suppose there is one in case of doMessage, where sender is the locals object of the myMethod, but the "caller" is myObject3)
Alright, so in order:
anotherMethodis received by the instance namedmyObject. This is done in the calling context (probably the Lobby, unless wrapped inside anotherdo()do()introduces a new scope, and does nothing with the calling scope. That is to say, you can't reference anything in the calling scope inside ado()unless it happens to be in the Protos hierarchy or introduced inside thedo().do()also takes a message tree, and so what you're doing is effectively sendingmessage(msg)to be evaluated inside the context ofmyObjectwhich doesn't make much sense sincemsgfirst off can't be found due to the scope not being available, and even if it was, wouldn't make a lot of sense. Generally, you want to do something like:msg doInContext(myObject)if you find yourself desiring to writemyObject do(msg).