OT: Re: null values in NSArray ???
OT: Re: null values in NSArray ???
- Subject: OT: Re: null values in NSArray ???
- From: Daniel Hedrick <email@hidden>
- Date: Fri, 17 Jan 2003 13:18:48 -0600
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.