If this is a feature, it's a nasty one.
wouter
wouter.abraham at pi.be
Tue Mar 18 07:07:01 EST 2003
> Bug or feature? or: Don't I love the mechanics of expansion
>
> * From: Victor Eijkhout
> * Subject: Bug or feature? or: Don't I love the mechanics of
> expansion
> * Date: Sun, 16 Mar 2003 17:42:18 -0800
>
> 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
>
---snip
> Anyway, solution:
>
> send "tt" && quote & the aaa of me & quote
>
------snip
> 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 <[EMAIL PROTECTED]>
> tel: 865 974 9308 (W), 865 673 6998 (H), 865 974 8296 (F)
> http://www.cs.utk.edu/~eijkhout/
> _______________________________________________
Hi Victor,
AFAICS it is all very consistent. No bug at all.
In the first handler :
on tt arg
put arg
end tt
on t
set the aaa of me to "a"
##### makes a custom property called "aaa" and the char "a" is put
into it
put 1 into a
##### a variable "a" is initiated with "1"
send "tt" && the aaa of me to me
##### the send command resolves to send "tt" && "a"
##### In this case there is also a variable a which contains "1" so
this variable is passed
end t
if one uses : send "tt" && quote & the aaa of me & quote
then the output is "a"
If "3,4" is put into a then the output of this handler is "3,4"
One can see that the params are resolved 1 time (hope I used the right
expression as I am not a pro)
In the next case :
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
The custom property is set to "3,4"
The send command is resolved to send "tt" && "3,4" which is as if
passing 2 parameters
If one replaces set the aa of me to "3,4" with set the aa of me to "3
- 4" then
the send command resolves to send "tt" && "-1"
Try this :
on t arg1,arg2,arg3
put arg1 && arg2 && arg3
end t
on tt
set the aa of me to "a,b"
put "3,4" into a
send "t" && the aa of me to me
end tt
then the send command resolves to send "t" && "3,4,b"
> If this is a feature, it's a nasty one.
>
> * From: Victor Eijkhout
> * Subject: If this is a feature, it's a nasty one.
> * Date: Mon, 17 Mar 2003 15:22:12 -0800
>
> In other words, I consider this a bug.
>
> on mouseup
> send "t 1" to me
> end mouseup
>
>
> on t a
> set the a of me to "bar"
> end t
>
>
> Guess what property gets set on mouseup?
>
> And what's worse, I don't see how I can hack my way around it, because
> <set the "a" of me> is illegal. Ok, take a different name for the
> parameter, but I want to use logical sounding names.
The above case :
on mouseup
send "t 1" to me
end mouseup
on t a
set the a of me to "bar"
end t
Here a custom property is created with the name contained in a.
In this case if a custom property has a number as name or even a space
as name then it can only be called by a variable containing the number
or the space.
on t a
set the a of me to "bar"
put the a of me ##### or put 1 into b; put the b of me
end t
So as you can see it is rather consistent ( and if I'm wrong, shoot me
:-)
Have a nice day,
WA
More information about the use-livecode
mailing list