kray at sonsothunder.com
Sun Nov 6 15:00:43 CST 2005
On 11/6/05 1:29 PM, "Alex Tweedly" <alex at tweedly.net> wrote:
> 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
> As far as I know, there is no performance impact.
Yes, so this becomes the scripter's preference. I'm on the other side of the
coin, and very rarely use explicitVariables. It's not because my typing is
necessarily any better than Alex's <grin>, but more because I'm a curmudgeon
and don't want (a) to type a whole bunch of extra declarations, and (b) hate
being reminded by the Script Editor that I need to do so when I forget.
So it's your choice - the only thing to keep in mind is if you create
plugins or stacks that need to work well alongside other people's stacks, it
is best to make your code "explicitVars compliant" because you never know if
someone else is going to turn explicitVars on or not. However for personal
use, do whatever is comfortable.
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com
More information about the use-livecode