Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: *Very* strange script / global variable behavior



Nigel Garvey wrote:

>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:

The ASLG is mostly incorrect. A named script object declared within another script object is initialised when the parent script object is initialised, same as property values and handler objects. Only unnamed script objects and script objects within declared handlers are initialised when the relevant code is executed. Simple demonstration showing when initialisation occurs:


on x(s)
display dialog s & " initialised"
end x
script
property a : x("unnamed script")
end script


    script o1
        property b : x("script o1")
        script o2
            property c : x("script o2")
        end script
    end script

This displays "script o1 initialised" and "script o2 initialised" when the script is compiled, and "unnamed script initialised" when run.

HTH

has
http://freespace.virgin.net/hamish.sanderson/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-users/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.