Re: Globals are considered harmful (was Re: Recursion script which doesn't?)
Re: Globals are considered harmful (was Re: Recursion script which doesn't?)
- Subject: Re: Globals are considered harmful (was Re: Recursion script which doesn't?)
- From: Ehsan Saffari <email@hidden>
- Date: Sun, 8 Apr 2001 13:28:06 -0600
On 08/04/2001 11:42, John W Baxter, email@hidden wrote:
>
At 13:32 -0600 4/7/01, Ehsan Saffari wrote:
>
>>it is too easy for the script writer to get confused. A script editor which
>
>>supports multiple panes would help.
>
>
>
>So is it bad to use a global if one is using SE, but OK in SD (or others?)
>
>
That wasn't my intent, but I see how you read it that way.
>
>
Script Debugger (and others with multiple panes or the equivalent) might
>
help recover from problems caused by globals simply because you can see
>
more than one part of your script at a time.
Not having used SE for anything of any consequence (or SimpleText FTM), I
may be biased. I've used Script Debbuger since version 1.0. It's not just
showing variables, the find & replace function, or TOC of SD helps keep
track of where locals/globals/properties are being used, amongst many
other features.
>
Aside from that, the debugging capabilities would help as well.
>
>
Or one could avoid the problems in the first place by leaving the errors
>
out of one's scripts, and a common source of errors is mismanaged globals.
>
If there are no globals, that particular error is impossible...if there are
>
few it is not too hard to avoid.
>
--
>
John Baxter email@hidden Port Ludlow, WA, USA
An example of how I use a global is to store the path to the applet at
the start of each run so I can write new files in the same location as
the applet.
I've never colloborated with others in writing a script (others who may
stomp on my globals, or think that they are local, that is). Nothing
beats careful debugging, and making sure the script provides the desired
result, and errors out gracefully, every time.
Thaks for all the help.
cheers
ehsan