Re: Interesting?
Re: Interesting?
- Subject: Re: Interesting?
- From: email@hidden (Michael Sullivan)
- Date: Sun, 3 Feb 2002 16:24:38 -0500
- Organization: Society for the Incurably Pompous
Victor Yee writes:
>
Sorry. It wasn't so interesting after all. I misinterpreted the results.
>
>
on z()
>
beep 2
>
return true
>
end z
>
set x to {1, 2, 3, z()}
>
It was just evaluating the result of the handler when creating the list.
You can actually put the handler in the list though, if you don't use
the parentheses:
Try
on z()
beep 2
return true
end z
set x to {1, 2, 3, z}
then try:
on z()
beep 2
return true
end z
set x to {1, 2, 3, z}
set w to x's last item
w()
And this will do the appropriate thing if you use a global a as well.
This is the sort of thing that got discussed in "Please pass the
handler" a while back (Maybe that was on Macscrpt...).
Note, your second script example was scaring me until I realized that
you weren't actually putting the handler in the list, but evaluating it
and having the result end up in the list. (If you pass the actual
handler, then it should have done 3 beeps, delay, 3 beeps).
Michael