Programing style
Eric Chatonet
eric.chatonet at sosmartsoftware.com
Mon Nov 20 03:36:40 EST 2006
Mark,
As this thread is about programming style, I want to add something:
I completely agree: I avoid too using globals and often I prefer to
use custom properties.
Probably because I have written plugins for the IDE and wanted to
avoid any conflict with any user ;-)
In addition, this way of doing allows to run a private "CleanStack"
handler which resets controls appearance, default values (for these
fake globals), etc. when saving the stack.
Le 19 nov. 06 à 19:39, Mark Wieder a écrit :
>> I am used to put a "u" before custom properties names.
>> As I put a "t" before local variables, a "g" before globals, etc.
>
> That's the convention I use as well, ala Richard's writeup. By placing
> a "t" before the local variables I can instantly tell the scope of a
> variable: whether it's local to the current handler or is script-wide.
>
> And the "g" prefix for globals has another advantage as well. I
> normally try to avoid globals, but there are times when they serve a
> useful purpose. If I later decide I can make a global into a local
> variable I run into a problem: globals are persistent, even after the
> stack that defined them is not longer present in the computer's
> memory. Changing a global by redeclaring it will result in a compiler
> error, but not if the "g" prefix is deleted.
>
> --
> -Mark Wieder
> mwieder at ahsoftware.net
Best Regards from Paris,
Eric Chatonet
------------------------------------------------------------------------
----------------------
http://www.sosmartsoftware.com/ eric.chatonet at sosmartsoftware.com/
More information about the use-livecode
mailing list