在玩了一会儿之后,答案似乎是使用
with
带标签的参数不会引入变量。相反,这些值按照在处理程序体中遇到的顺序分配给局部变量。
示例:
on baa of thing with frst and scnd
scnd
frst
return {frst:scnd, scnd:frst}
end baa
on bas of thing with frst and scnd
-- note that eat_frst gets the value of the frst parameter,
-- then gets set to "set"
set eat_frst to "set"
eat_scnd
return {frst:eat_frst, scnd:eat_scnd}
end bas
on qux of thing with frst and scnd
if scnd then
end if
local eat_scnd, eat_others
return {frst:scnd, scnd:eat_scnd}
end qux
on quux of thing with frst and scnd
if frst then
end if
if eat_scnd then
end if
return {frst:frst, scnd:eat_scnd}
end quux
{ baa: (baa of "baa" with frst without scnd), ¬
bas: (bas of "bas" with frst without scnd), ¬
qux: (qux of "qux" with frst without scnd), ¬
quux: (qux of "qux" with frst without scnd) }
结果:
{ baa:{frst:true, scnd:false},
bas:{frst:"set", scnd:false},
qux:{frst:true, scnd:false},
quux:{frst:true, scnd:false}}