Re: Modifications and Variables
Re: Modifications and Variables
- Subject: Re: Modifications and Variables
- From: Paul Berkowitz <email@hidden>
- Date: Sun, 05 Jan 2003 13:57:08 -0800
Yes, I know all about that. You must be late to the thread, I went into all
that the last time. OK, here we go again. Yes, I realize that the script can
"see" top-level variables and can declare them global from within other
handlers. That's why I call them "potential globals". But, unless you do
declare them as globals somewhere, they behave as locals with regard to
scope. That makes them not quite real globals, and therefore something of a
surprise to discover they are persistent like real globals are. they have a
sort of "filtered-out" global scope until they are declared global
somewhere. I can even see how this sort of setup (not declaring as global in
top-level run handler itself) can make them accessible just to those
handlers which declare them as global, and not to others - pretty nifty. but
they're still not quite like globals which are declared as such at the top
level, which was my point all along.
--
Paul Berkowitz
>
From: Shane Stanley <email@hidden>
>
Date: Mon, 06 Jan 2003 08:36:30 +1100
>
To: AS lists <email@hidden>
>
Subject: Re: Modifications and Variables
>
>
On 6/1/03 7:20 AM +1000, Paul Berkowitz, email@hidden, wrote:
>
>
> If x is a global, then why is it undefined?
>
>
Compare these two variations of your scripts:
>
>
set x to 3
>
>
myHandler()
>
>
on myHandler()
>
global x
>
display dialog (x as string)
>
end myHandler
>
>
And:
>
>
on otherHandler()
>
set x to 3
>
end otherHandler
>
>
otherHandler()
>
myHandler()
>
>
on myHandler()
>
global x
>
display dialog (x as string)
>
end myHandler
>
>
--
>
Shane Stanley, email@hidden
>
_______________________________________________
>
applescript-users mailing list | email@hidden
>
Help/Unsubscribe/Archives:
>
http://www.lists.apple.com/mailman/listinfo/applescript-users
>
Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.