Best Practices
Alex Tweedly
alex at tweedly.net
Sun Nov 6 14:29:03 EST 2005
Erin D. Smale wrote:
> * Variables: I understand that vars are defined when they're
> initialised (except globals, which need to be declared). This upsets
> my sense of order somewhat, but I can see the advantages. That said,
> is it best to declare variables anyway? Is there any performance
> impact if I do or don't? Is it best practise to use the
> explicitVariables property?
I almost always use explicitVariables, and therefore almost always
declare variables.
If your typing is as bad as mine, then it's worth small amount of extra
typing for the convenience of finding all your typos immediately, rather
than wait to see the bug symptoms. I think it's good practice to do so;
sometimes if I'm writing temporary code, or a quick test to see how
something works, or a short-lived script for my own purposes, I'll turn
explicitVariables off and enjoy the convenience of not declaring - but
all important code gets tested, and usually written, using
explicitVariables.
As far as I know, there is no performance impact.
--
Alex Tweedly http://www.tweedly.net
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.362 / Virus Database: 267.12.8/161 - Release Date: 03/11/2005
More information about the use-livecode
mailing list