Bug or feature? or: Don't I love the mechanics of expansion

Victor Eijkhout eijkhout at cs.utk.edu
Sun Mar 16 20:46:01 EST 2003


This bug took me an hour or two to find. I don't think I like it.

on tt arg
   put arg
end tt

on t
   set the aaa of me to "a"
   put 1 into a
   send "tt" && the aaa of me to me
end t


Guess what the outcome of `send "t" to field "whatever" is...

Reading the man page for "send". It says (I couldn't manage to 
cut/paste from the dictionary. is that possible?) "If the message is 
more than one word, it must be enclosed in double quotes". That is 
clearly not true in the above case.

It also says "Any parameters are evaluted", giving <send "mouseup 
1+1"> as example. That is less than the whole truth: based on this I 
would write <send "tt the aaa of me"> which of course is completely 
incorrect.

Anyway, solution:

send "tt" && quote & the aaa of me & quote

I guess the correct statement would be

"send expr to <whatever> :

the "expr" is an expression that yields a string of the form "command 
arg1,arg2,...". The "argn" expressions are evaluated in the corrent 
context, and the resulting command is sent to the whatever handler."

Ok, quiz time: what is the output of

on t arg1,arg2
   put arg1
end t

on tt
   set the aa of me to 3,4
   send "t" && the aa of me to me
end tt

(I guess, for clarity, another clause is could be added in the above 
definition.)
-- 
Victor Eijkhout <eijkhout at cs.utk.edu>
tel: 865 974 9308 (W), 865 673 6998 (H), 865 974 8296 (F)
http://www.cs.utk.edu/~eijkhout/



More information about the use-livecode mailing list