Custom Properties vs globals

Ken Ray kray at sonsothunder.com
Tue Jul 17 11:24:32 CDT 2007


On Tue, 17 Jul 2007 09:59:28 +0800, Kay C Lan wrote:

> I'm just trying to formulate some 'rules of thumb' of when to use custom
> props and when globals, so I can avoid the 'goshhhh, now I need to change
> all those to .......... because I need to.....' moments ;-)

One thing to keep in mind is that globals are automatically purged when 
Rev quits, whereas custom properties have the *possibility* of being 
saved in a particular state, especially if this is a "data stack" that 
you're allowing users to add data to and save to disk.

So to be 100% accurate, you'd need to always clear out the custom 
properties you plan on using for "stack-level globals". And to that 
end, I've been using custom property *sets* for this purpose, so I can 
lump all my stack-level globals into a single custom property set that 
I can delete when my program launches before any props are set. If the 
set doesn't exist, no problem and no error; if it does, it gets wiped.

Eventually it would be nice to be able to declare stack-level globals 
(or whatever one might want to call them) that get the benefit of 
automatic purging and don't collide with other stacks...


Ken Ray
Sons of Thunder Software, Inc.
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/



More information about the use-livecode mailing list