Re: nil in NSArray
Re: nil in NSArray
- Subject: Re: nil in NSArray
- From: Clark Mueller <email@hidden>
- Date: Sat, 13 Dec 2008 18:39:57 -0800
Oh, I see. You wanted explanation. :-)
I suppose that if nothing else it would be for historical reasons, but
I was under the impression there was a point to NSNull. Specifically,
aren't there scenarios where you might want to distinguish a null
pointer from querying for the "presence" of a null value?
For example, in WO, if you're using an NSDictionary "bindings" for
query bindings, you might want to query for some attribute
"myAttribute" that equals NULL in your database, so you would do
something like bindings.setObjectForKey(NSKeyValueCoding.NullValue,
"myAttribute"). So when EOF is constructing the qualifier, it knows
that it should produce "WHERE my_attribute = NULL", but that when
bindings.objectForKey("myOtherAttribute") is null (as in a null
pointer), it knows that's not an attribute you want to qualify on.
Am I wrong? Wouldn't the same apply to some scenarios in Cocoa in the
context of Core Data? Or certainly, to the defunct Objective-C version
of WO?
Clark
On 13-Dec-08, at 5:58 PM, Mike Schrag wrote:
Cocoa Foundation has NSNull as JavaFoundation does, why not use that?
The NSNull class defines a singleton object used to represent null
values in collection objects (which don’t allow nil values).
... because it's a lame hack :) ? I know there are workarounds, but
in 2008, I don't expect junk like that. I can't imagine it's really
a null-terminated array in NSArray's implementation. They almost
certainly track count as an int separately, and therefore wouldn't
need null-termination of the internal array.
ms
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden