Re: Script Object Order in Script
Re: Script Object Order in Script
- Subject: Re: Script Object Order in Script
- From: Deivy Petrescu <email@hidden>
- Date: Tue, 24 Jul 2001 13:00:02 -0400
At 11:34 AM -0400 7/24/01, Arthur J Knapp wrote:
Is this a bug, or a feature? :
<snip>
This also does not work :
<script>
property whaty : 1
on CallProperties()
set y to whaty
set z to whatz
return {y, z} -- error "The variable whatz is not defined."
end CallProperties
property whatz : 2
CallProperties()
</script>
but this does
<script>
property whaty : 1
set y to whaty
set z to whatz
return {y, z}
property whatz : 2
</script>
In other words, the handler CheckScriptProperties can't "see"
the script object zzz, appearently because it is defined after
the handler is. I don't understand why it should behave this way.
Handlers have no difficulty calling on other handlers that have
been defined after them, as in:
<snip>
It seems to me that after the script has been compiled, all
script objects defined at the top-level of the script should
be just as "global" as all handler definitions.
Handlers are callers, so once a call is made the script search for
the handler of that call.
Properties (and script, as you found out) inside handler behave live
variables, if you did not define them before hand the
handler will throw an error.
Regards
Deivy Petrescu
http://www.dicas.com