discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: patch for NSApplication.m


From: Nicola Pero
Subject: RE: patch for NSApplication.m
Date: Thu, 25 Jul 2002 14:29:56 +0100 (BST)

> > > However, it bothers me to see an object assigned to global variable NSApp
> > > before the object is initialized.  Changing the code slightly would
> > > initialize the object before it's assigned.
> > >
> > > Also, to be consistent with the singleton pattern, method -[NSApplication
> > > init] should _not_ assign a value to NSApp.  All usages of NSApp in this
> > > method should be changed.
> >
> >I'm sure some one "official" will review your patch and give his two cents,
> >but I believe the point was to make sure that anyone trying to create a new
> >instance by using [[NSApplication alloc] init] or [NSApplication new] or
> >whatever will always get the singelton. The current implementation enforces
> >it. With your patch, someone could create NSApplication-Objects before
> >sharedApplication is called and there would be multiple NSApplication
> >objects. The way it is now, this can't happen. Or am I missing something
> >here?
> >
> >Cheers,
> >Dave
> 
> Dave,
> 
> That makes sense, though I think having two assignments to NSApp is 
> wrong.  If the assignment is to be in -init, then +sharedApplication only 
> needs call [[self alloc] init] and doesn't need to assign the value to NSApp.

Thanks - I agree that the original code - while behaving quite well in
normal situations - was a bit confusing and that rearranging it was a good
idea. :-)

Thanks also to all the people who contributed comments - very interesting
- I have simplified the code on CVS (0.8.0 branch) a lot, and hopefully
the code should be now very simple and clear, 100% correct and verbosely
commented :-)

Please have a look at it and let me know if there is something you are not
happy with.

Thanks again for your time.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]