• 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: *Very* strange script / global variable behavior
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: *Very* strange script / global variable behavior


  • Subject: Re: *Very* strange script / global variable behavior
  • From: Nigel Garvey <email@hidden>
  • Date: Mon, 28 Feb 2005 21:29:09 +0000

has wrote on Mon, 28 Feb 2005 13:56:04 +0000:

>Nigel Garvey wrote:
>
>>Script objects are definitions that are only initialised when the code
>>containing them is run, so Outer only comes into being just before the
>>'set x to Outer' line.
>
>Incorrect. The script object in the Outer slot is created when that
>slot is initialised, i.e. when the script object whose slot that is
>is created.

So far, that's pretty much what I said.

>And this script object, being the top-level script
>object, is created at compile-time; ergo the script object in Outer
>is also created at compile-time.

Not according to ASLG, but maybe you have a better source:

"Initializing Script Objects

"When you define a script object, you define a collection of handlers and
properties. When you run a script containing a script object definition,
AppleScript creates a script object with the properties and handlers
listed in the definition. This is called initializing a script object. A
script object must be initialized before it can respond to commands.

"If you include a script object definition at the top level of a script
‹ that is, as part of the script¹s Run handler ‹ AppleScript initializes
the script object each time the script¹s Run handler is executed. For
more information, see ³Run Handlers² (page 303).

"Similarly, if you include a script definition in another handler within
a script, AppleScript initializes a script object each time the handler
is called."

>The simplest solution would be to redesign the code to avoid the
>problem in the first place.

Agreed.

NG
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: Called script won't store property
  • Next by Date: Re: What is this?
  • Previous by thread: Re: *Very* strange script / global variable behavior
  • Next by thread: Re: *Very* strange script / global variable behavior
  • Index(es):
    • Date
    • Thread