how to check for unnecessary local declarations?

Bob Sneidar bobsneidar at iotecdigital.com
Thu Jul 2 23:30:18 CEST 2015


Globals are problematic for me as I design stacks and cards to be modular, so two stacks with the same utility card for example, would be sharing globals. Instead, if I need persistent data, I use properties. I also do not use strict compilation. I have a naming system that prevents my ever using the same variable twice for different things in the same handler. Even in loops that use a counter, the counter variable is very specifically named. 

That being said, it occurs to me that the GLX2 script editor knows what is a variable because it color codes them, and also keeps track of them for the clairvoyance feature. Crack that code open to see how they do it, and that should give you a great way of tracking them yourself. 

Bob S


> On Jul 2, 2015, at 03:20 , Francis Nugent Dixon <effendi at wanadoo.fr> wrote:
> 
> Hi from Beautiful Brittany (where it is raining, and there is a cool breeze,
> while the rest of France is in the high 30’s  :>))
> 
> In the same vein,
> 
> I declare all my variables “global" in two ways ; the first which will remain
> when testing is finished (i.e.. passing info outside the script); the others
> which will be commented out after testing. If I return to this stack at a
> later date to modify it, I remove the comments until I have finished testing
> again. Whenever I “invent” a variable, I always declare it global, either permanent
> or temporary, and so I cannot end up have unused variables.
> Declaring all variables as global, especially when I have some math in my
> scripts, running step by step (debug mode) helps check out my math
> easily and efficiently.
> All my variable names begin with “GV" or “LV” which helps me not to make
> mistakes. Its the stupid mistakes which add to development time.
> 
> Oh ! I forgot ! I sleep little, and so during the night, I plan out my stack
> development, even to script layout, Next morning I code, and find that I
> have done much of the debugging in my head, diring the night.
> 
> Anybody out there got any strange quirks like mine ? (more than 50 years
> of programming leaves deep scars …. !!!).
> 
> -Francis
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode




More information about the use-livecode mailing list