Re: NSNull and @""
Re: NSNull and @""
- Subject: Re: NSNull and @""
- From: Ian Joyner <email@hidden>
- Date: Sat, 11 Oct 2008 11:40:07 +1100
On 11/10/2008, at 9:33 AM, Seth Willits wrote:
On Oct 10, 2008, at 3:20 PM, DKJ wrote:
I've made an NSDictionary where the values are strings. Is there a
difference between setting a value as [NSNull null] and setting it
as @""? (I've been using the former.)
Is there a difference? Definitely. One is an instance of NSString,
the other is an instance of NSNull. NSNull is not special. It's an
object just like any other.
I'm just trying to work out what NSNull really is in the Cocoa
context. Is it an object in Cocoa? I think (from other environments)
that it is a type signifying "no object". Since NSNull may be a
"valid" value of any other type, is it counted as a subtype of every
other type (hence the ultimate subclass)? I think a good and simple
(one that doesn't make my brain hurt) definition of NSNull is
important in order to ensure software correctness.
"Passing paths that climb half way into the void"
Whether you want to use an empty string or an NSNull is up to you.
If an empty string is a legal value, then you could use NSNull to
represent there being no value given. (Or just simply don't have
anything in the dictionary.)
--
Seth Willits
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden