Re: Why does NSArray count return NSUInteger?
Re: Why does NSArray count return NSUInteger?
- Subject: Re: Why does NSArray count return NSUInteger?
- From: Graham Cox <email@hidden>
- Date: Tue, 31 May 2011 10:56:43 +1000
On 31/05/2011, at 8:57 AM, Greg Guerin wrote:
> julius wrote:
>
>> My question is
>> Why did Cocoa developers make NSArray count return NSUInteger?
>
> In a practical sense, none of this matters. The decision was made long, long ago. It is what it is. You're too late to save that sheep from drowning.
No API is perfect, and Cocoa is no exception. I learned a long time ago that it's a bit pointless to fret about the why and just understand how it is. That way, you get your apps written and out of the door. There are plenty of questionable and strange things in Cocoa that in hindsight could have been done better, or at least differently, but they weren't.
In NSArray in particular, a more interesting thing which is both a good and bad thing depending on the hour of the day, is that you can't specify, find out or restrict the object types it holds. Obj-C has no syntax (as C++ does, for better or worse) for templating collection types. In practice this doesn't matter, even though sometimes it causes bugs, just as faulty signed/unsigned arithmetic causes bugs. In the end, no language can save you from yourself.
--Graham
_______________________________________________
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