aetaylorBUSBnWt wrote: ↑Fri Aug 14, 2020 10:41 pm
So if I want to call the reportBehav function in the behav1 button with the variable value content of "me", I thought I would add a parameter to the function to specify what I wanted the function to operate on.
I have found that there is a difference between:
dispatch "reportBehav" to the behavior of me with me
and
dispatch "reportBehav" to the behavior of me with long id of me
What is being passed when you specify "me" vs "long id of me"?
if you pass "me" as a parameter you get nothing (empty) because you can only pass a property of me (name, width etc)
In case of passing the "long id of me" as parameter you get exactly that at the receiving end
If you pass "me" and in the function it is referred to as "pid" and you try the following: "name of pid", you get a chunk error.
(whatever that is)
Since "me" as parameter is empty you can not extract the name of it. A chunk is for example: char 3 of word 4 of line 6 of field 1. If that can not be resolved you get a chunk error. Here you can not get the "name" of pid which is also chunking.
Probably the compiler should have caught passing "me" as parameter and should have thrown an error.
If you pass "long id of me" and in the function it is referred to as "pid" and you try the following: "name of pid", you don't get an error.
You don't get the name, but that is a different problem - I think, I hope.
When I tried that I did get the "name of pid" from the parameter "long id of me". Don't know what happened.
As shown you can not address a behavior directly because you loose context. It has to pass through the object that has the behavior/s as a parent.
Oh, and the dictionary says:
When the pass control structure is executed, any remaining
statements in the handler are skipped. Hence, the pass
control structure is usually used either at the end of a handler or
within an if control structure.
this is what is happening, "pass" ends the execution of the rest of the handler and passes the message. The dictionary has some misleading descriptions but this seems to be correct.
Since I am not familiar with Superclasses and OOP I can not comment on that part.But I liked Mark Wieder's stack as an example.
Kind regards
Bernd