Re: *Very* strange script / global variable behavior
Re: *Very* strange script / global variable behavior
- Subject: Re: *Very* strange script / global variable behavior
- From: Axel Luttgens <email@hidden>
- Date: Sun, 13 Mar 2005 20:48:09 +0100
(and I again forgot to change the recipient field...)
Paul Berkowitz wrote:
On 3/13/05 8:01 AM, "Axel Luttgens" <email@hidden> wrote:
By contrast, should someone have asked why following code errors,
everybody would have said "hey! that's normal! you wouldn't want to be
able to clash local variables that way, would you?":
-- Code4
set SomeProp to "xyz"
script LogIt
log SomeProp
end script
tell LogIt to run
--> Error: variable SomeProp is undefined
So, everyone would understand the error produced by Code4 because of
basic and almost universal programming rules.
Hmmm? SomeProp is not a local variable.
I disagree ;-)
Within Code4, SomeProp designates a entity local to LogIt's implicit
run handler.
As well as a global variable implicitely declared at the script's
top-level.
And those two beasts, the local one and the global one, really are
distinct.
It is only when other scoping hints are provided, such as in your
Code4A or in my Code1bis, that identifier SomeProp may be brought to
designate the same global entity.
Axel
|
_______________________________________________
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