On Sat, Oct 11, 2008 at 2:58 AM, Seth Willits <[EMAIL PROTECTED]> wrote:
> On Oct 10, 2008, at 5:40 PM, Ian Joyner wrote: > > I'm just trying to work out what NSNull really is in the Cocoa context. Is >> it an object in Cocoa? >> > > > As I said, yes. It's truly an object. (A singleton, as well.) > > > > 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. >> > > Woah. Talk about brain hurt. You're thinking about this far too much. > > There's no inheritance, there's no nothing. It's an object. It's absolutely > in no way different than you creating your own IJNull class, and sticking an > instance of it anywhere. It doesn't behave any differently. > > > As for use, the documentation says it pretty clearly: > > "The NSNull class defines a singleton object used to represent null values > in collection objects (which don't allow nil values)." > > > You can't stick nil into dictionaries and arrays. So either you stick an > empty string, an NSNumber with 0, etc if those are OK, or you can use > NSNull. > > Hmm, that's weird. In some official iPhone examples from Apple, they do exactly that: they put nil as the last element in an array. So what's up with that? S. _______________________________________________ Cocoa-dev mailing list ([email protected]) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
