Re: OT: Re: null values in NSArray ???
Re: OT: Re: null values in NSArray ???
- Subject: Re: OT: Re: null values in NSArray ???
- From: The Amazing Llama <email@hidden>
- Date: Fri, 17 Jan 2003 11:28:23 -0800
This becomes somewhat problematic, however, as soon as you start using
databases, where NULL != NULL.
Then you have to go right back rolling your own class. It would be nice
if NSNull had:
+ (BOOL)treatAsSingleton;
+ (void)setTreatAsSingleton:(BOOL)flag;
which would not actually make NSNull a singleton, but would simply make
instances return no to the isEqualTo: message.
This is what I'm planning on doing next week (in a category), when I
have to tackle the problem for myself.
On Friday, January 17, 2003, at 11:18 AM, Daniel Hedrick wrote:
Sayeth Brian Webster on Fri, Jan 17, 2003 at 11:29:38AM -0600:
On Friday, January 17, 2003, at 09:56 AM,
email@hidden wrote:
Can anyone tell me if it is possible to manage an NSMutableArray
that
contains null values for objects at any given index ?
I don't want to incur
the overhead of the NSNull object allocation(s) in a large grid.
I haven't tested this, but I always assumed that calling [NSNull null]
will return you a single instance of NSNull instead of creating a new
instance of NSNull, since there's really no reason to have more than
one around.
Funny story, although not really topical...
As I read the original post, I was thinking, "Hrm... it _would_
be cool if you could use nil." Then I remembered a similar
problem I had in Java and how I solved that problem, using a
homemade class similar to NSNull. I had made my Empty class
a singleton, and I thought to myself, "well, it would be
really cool if NSNull were a singleton and that overhead
could be incurred once."
Being fairly unfamiliar with Cocoa still, when I saw the
follow-ups that explained that NSNull _WAS_ singleton, I
thought, "Wow! Good call."
Sorry to relate this. I'm just such a goof-ball programmer
that I get a kick from any time I manage to pull one
outta my hat like that and I get it right.
8-)
Thx,
-daniel
email@hidden
--
There are 10 types of people in this world...
those who understand binary, and those who don't.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
Seth A. Roby The Amazing Llama < mail or AIM me at tallama at mac dot
com>
"Life is like an exploded clown. It's really funny until you figure out
what just happened."
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.