At 12:08 -0700 03/08/2002, Evan Adelman wrote:
>When initially defining variables in Lingo, is it a good idea to set
>them to VOID, or 0 prior to assigning the object (XML xtra,
>FileXtra3, any parent script)?
It's not actually necessary, but it is *extremely* good practice, to
set your vars to *something*.
They're already void, so setting them to void is redundant (and I'm
one of those purists who believes that void = mistake, so I wouldn't
recommend *ever* setting a variable to void anyway).
The way I generally do things is to use "" for strings, 0 for
numbers, #null for symbols and [] or [:] for lists. That way I can
test them for their specific types. I also set parent objects to 0.
For parent objects, I ony zero them after destructing 'em. But I am
moving away from those too. My current project, in fact, has nothing
but sprite-instanced behaviors controlling all the interaction, and
boy is this one big fat mutha of a project. It's rather interesting
to be totally global free. Without object code this would quickly
disintegrate into a morass of error-prone logical spaghetti.
The reason variable initialization is a good habit to be in, if it's
not technically necessary? Well, it's expected in many other
languages, and as a programmer it does not hurt to set up your vars
when you create them. It implies you're well-informed about the way
your own code functions. ;)
As for why your XML parser is working now... heh, who the heck knows?
As a guess I'd say it's because Io is no longer being occulted by
Jupiter.
--
Warren Ockrassa | http://www.nightwares.com/
Director help | Free files | Sample chapters | Freelance | Consulting
Author | Director 8.5 Shockwave Studio: A Beginner's Guide
Published by Osborne/McGraw-Hill
http://www.osborne.com/indexes/beginners_guides.shtml
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/lingo-l.cgi To post messages to the list, email
[EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for
learning and helping with programming Lingo. Thanks!]