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

Geoff Canyon gcanyon at inspiredlogic.com
Mon Mar 17 22:35:00 EST 2003


Exactly one step of evaluation is performed. So if you say

send "tt the aaa of me"

it will in fact work, and result in "a" being put. When you say

send tt && the aaa of me

What happens is that tt && the aaa of me is resolved (by the && 
operator) into "tt a" which is then passed to the evaluator for that 
one step of evaluation, which results in "a" being interpreted as a 
variable, resulting in 1 in the message box.

On Sunday, March 16, 2003, at 05:42 PM, Victor Eijkhout wrote:

> 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/
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
>

regards,

Geoff Canyon
gcanyon at inspiredlogic.com




More information about the use-livecode mailing list