Re: global NSMutableDictionary

2008-07-30 Thread Michael Ash
On Tue, Jul 29, 2008 at 10:07 PM, Greg Parker <[EMAIL PROTECTED]> wrote: > Michael Ash wrote: >> >> On Tue, Jul 29, 2008 at 2:04 PM, Bill Bumgarner <[EMAIL PROTECTED]> wrote: >>> >>> Or you could annotate a function as a constructor. It will run before >>> main(). >>> static void __InitializeGloba

Re: global NSMutableDictionary

2008-07-29 Thread Greg Parker
Michael Ash wrote: On Tue, Jul 29, 2008 at 2:04 PM, Bill Bumgarner <[EMAIL PROTECTED]> wrote: Or you could annotate a function as a constructor. It will run before main(). static void __InitializeGlobalStuffMan(void) __attribute__ ((constructor)); void __InitializeGlobalStuffMan(void) {

Re: global NSMutableDictionary

2008-07-29 Thread Kirk Kerekes
Consider class methods instead of globals. See: Unmentioned there is the additional advantage of lazy initialization: (composed in Mail) + (NSMutableDictionay *) myGlobalDict { static NSMutableDictionary * result = nil; if(!result)

Re: global NSMutableDictionary

2008-07-29 Thread Michael Ash
On Tue, Jul 29, 2008 at 2:04 PM, Bill Bumgarner <[EMAIL PROTECTED]> wrote: > On Jul 29, 2008, at 10:57 AM, Nathaniel Gottlieb-Graham wrote: >> >> Why do externs seem to have to be NSStrings? Also, is this even the right >> way to go about having a read/write global NSMutableDictionary? If not, ho

Re: global NSMutableDictionary

2008-07-29 Thread Nathaniel Gottlieb-Graham
Holy moly, that's just what I needed. This dictionary in fact originated in the controller app delegate, and I had no idea you could reference things inside the app delegate like that! Thanks so much! On Jul 29, 2008, at 2:16 PM, I. Savant wrote: On Tue, Jul 29, 2008 at 1:57 PM, Nathanie

Re: global NSMutableDictionary

2008-07-29 Thread I. Savant
On Tue, Jul 29, 2008 at 1:57 PM, Nathaniel Gottlieb-Graham <[EMAIL PROTECTED]> wrote: > I am trying to implement a global variable that's an NSMutableDictionary. In addition to Bill's response, I'd like to take a different direction. :-) Why are you trying to implement this as a global? Typicall

Re: global NSMutableDictionary

2008-07-29 Thread Devon Ferns
I think you probably want to use the singleton design pattern rather than that global variable. Devon. Nathaniel Gottlieb-Graham wrote: I am trying to implement a global variable that's an NSMutableDictionary. Up until now I've achieved this by making globalVariables.h and .m files to hold g

Re: global NSMutableDictionary

2008-07-29 Thread Bill Bumgarner
On Jul 29, 2008, at 10:57 AM, Nathaniel Gottlieb-Graham wrote: Why do externs seem to have to be NSStrings? Also, is this even the right way to go about having a read/write global NSMutableDictionary? If not, how would I do this? The variables cannot point to anything that isn't a constant