• 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: Christopher Nebel <email@hidden>
  • Date: Thu, 26 Jul 2001 00:22:31 -0700

On Wednesday, July 25, 2001, at 08:33 PM, email@hidden wrote:

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.

I don't recall ever explaining this, but that is the correct answer. Because AppleScript doesn't require you to declare variables before using them and has a single-pass compiler, it has to decide whether something is a local or global based on what it's already seen. The default for anything inside a handler is that it's a local, unless you explicitly qualify it using "my" or "of something".


--Chris Nebel
AppleScript Engineering


References: 
 >Re: Script Object Order in Script (From: email@hidden)

  • Prev by Date: Re: Choose Desktop Printer
  • Next by Date: Scripting QuarkXPress Passport 4.11
  • Previous by thread: Re: Script Object Order in Script
  • Next by thread: Re: Script Object Order in Script
  • Index(es):
    • Date
    • Thread