• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Why does NSArray count return NSUInteger?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Re: Why does NSArray count return NSUInteger? (From: Greg Guerin <email@hidden>)

  • Prev by Date: Re: Linearly Scaling Text
  • Next by Date: Re: Why does NSArray count return NSUInteger?
  • Previous by thread: Re: Why does NSArray count return NSUInteger?
  • Next by thread: Re: Why does NSArray count return NSUInteger?
  • Index(es):
    • Date
    • Thread