Re: AppleScript-Users Digest, Vol 6, Issue 40
Re: AppleScript-Users Digest, Vol 6, Issue 40
- Subject: Re: AppleScript-Users Digest, Vol 6, Issue 40
- From: "Stockly, Ed" <email@hidden>
- Date: Mon, 26 Jan 2009 14:18:04 -0800
- Thread-topic: AppleScript-Users Digest, Vol 6, Issue 40
>>>Mark>>> Drawing a line between "programming" vs "scripting" is a false
dichotomy; it's all programming.
Well, we disagree. I don't believe that writing a few appleScripts makes me
a programmer. I planted some shrubs in my garden, that doesn't make me a
gardener or even a shrubber.
>>> Global variables are bad because they make it harder to tell what's going
on.
In cases where global variables make it harder to tell what's going on, they
shouldn't be used.
I don't believe that applied in this case or in most cases where I use them.
>>>To know that the handler is setting the global, I have to go read the handler
code - which defeats the purpose of making it a handler in the first place,
which is that I should be able to read the calling code and tell what it's doing
without getting distracted by the details of how it does it.
There are other purposes in using handlers, I'm not sure if that's even a
primary purpose.
If global variables are used carefully and judiciously, it's no more
difficult to keep track of them than any thing else.
>>> But either way you should think about it first.
Rather than have a "knee jerk" reaction?
>>>I don't see any reason for "scripters" in general to ignore the time-honored
wisdom that global variables are a mechanism of last resort.
I'd say that most of the reasons that was considered wise do not apply to
scripting. Nor do I advocate using globals to excess. In this case that was
a perfectly fine use of a global.
>>> However, in the particular case of AppleScript, I have seen repeated
reference to the fact that list manipulations are faster on globals/properties,
and similar observations; I was just trying to see if that's what was going on
here.
That probably wasn't the reason globals were used in this case. The variable
was global by default.
Also, with AppleScript, variables and properties have persistence between
runs which can prove useful.
ES
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden