Custom Properties vs globals

Michael Binder runr at prismpole.com
Tue Jul 17 06:38:26 EDT 2007


Hi Kay,

> so I can avoid the 'goshhhh, now I need to change
> all those to .......... because I need to.....' moments ;-)

One reason to avoid globals... suppose you have a working app that
is (just for example) a calendar.  It can create and save a calendar
as a document (data file).  You use a global 'gSaveFlag' whose value
is 'true' when the user changes the calendar.  You know to save the
changes when 'gSaveFlag' is true.

Someday you decide to rewrite your app so that it can open two
calendars at once.  You may find the globals in one calendar
are cross-reacting with the globals in the other calendar.

If you use a substack as a calendar viewer/editor, and set the
saveFlag of substack 'myCalendarViewer' to true, you can then
clone the substack as many times as you like and each clone
will have its own 'saveFlag'.

hth, Michael Binder




More information about the use-livecode mailing list