• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Script Object Order in Script
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Script Object Order in Script


  • Subject: Re: Script Object Order in Script
  • From: Arthur J Knapp <email@hidden>
  • Date: Thu, 26 Jul 2001 10:33:48 -0400

> Date: Wed, 25 Jul 2001 23:33:54 -0400
> From: email@hidden
> Subject: Re: Script Object Order in Script

>> script aaa
>> property whatever : "aaa"
>> end script
>>
>> on CheckScriptProperties()
>> whatever of aaa --> "aaa"
>> whatever of my zzz --> "zzz"
>> end CheckScriptProperties
>>
>> script zzz
>> property whatever : "zzz"
>> end script
>>
>> CheckScriptProperties()

> I think Chris Nebel explained a while ago what was going on inside the
> compiler.
> When "whatever of aaa" is begin compiled, the symbol table has an entry for
> "aaa" as a top-level script object. So the reference to "aaa" in "whatever of
> aaa" is encoded as a reference to that object. But when "whatever of zzz" is
> seen, "zzz" isn't in the symbol table. So the compiler decides this is a
> local
> variable of the CheckScriptProperties function, and creates such an entry in
> the
> symbol table. That local variable then masks the top-level script object zzz
> when the script runs.

This is interesting. I wonder how the encoding of handlers is different.

> When you include "my", that prevents "zzz" from being entered in the symbol
> table as a new local symbol, but forces it to be a top-level variable.
>
> This seems buggy,

Not really. I just wanted to understand the underlining reasons. I am
currently working on a script where, (for organizational purposes), it isn't
always convenient to define my script objects at the top of the script. The
simplist way for me to avoid this problem will be to simply use the "global"
declaration statement where needed.


One can always count on Scott Norton for clear explanations... :)


Arthur J. Knapp
http://www.stellarvisions.com
mailto:email@hidden

Hey, check out:
http://www.seanet.com/~jonpugh/


  • Prev by Date: Making a script multi-user for server use
  • Next by Date: Control on remote machine
  • Previous by thread: Re: Script Object Order in Script
  • Next by thread: File sync script--comments?
  • Index(es):
    • Date
    • Thread