Weirdness Passing Messages

J. Landman Gay jacque at hyperactivesw.com
Fri Mar 24 11:12:30 EST 2006


David Burgun wrote:

> Incidentally, the above works  just fine regardless of the stack/card/ 
> object using "put <something> into me". The problem I described  
> yesterday was brought to light because when a new folder is selected,  I 
> wanted to select the first line (file) in the list, so inside  
> ISM_FolderSelect(), I did a ISMPutMessage("ISM_FileSelected,  kFileKind, 
> line 1 of me), when this happened, "me" in the receiving  handler got 
> Beswick'ed!

Which is reasonable, I think. Think about this a moment -- parameters 
are always evaluated before being passed. When you pass "me" in a 
parameter, the "me" will refer to the object currently executing the 
script, not the target object the script will eventually refer to later. 
This is normal behavior.

Take this example:

   addNums (1+1)

The addNums handler will receive a parameter of "2", not "1+1". Ditto 
for "me", which will be interpreted as the object *currently* running 
the script, not the future target of the handler reference.

When passing a reference parameter, use an ID or other static reference, 
not "me" which is always subject to interpretation. As you found out. ;)

If you absolutely must use "me" then you can try putting the parameter 
in quotes to force it into acting as a string. Strings won't be 
evaluated. I don't know if this will work in your situation but you can 
try it.

Now that I understand your usage better, I do not think this is a bug.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com



More information about the use-livecode mailing list