• 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: nil in NSArray
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: nil in NSArray


  • Subject: Re: nil in NSArray
  • From: Alex Horovitz <email@hidden>
  • Date: Mon, 15 Dec 2008 10:08:03 -0500


On Dec 13, 2008, at 7:40 PM, Mike Schrag wrote:

OK -- So what's the official reason why you aren't allowed to put a nil into an Objective-C NSArray?  It seems like a pretty silly restriction to me ...

Mike - I asked Steve Naroff for you...

On Dec 15, 2008, at 10:00 AM, steve naroff wrote:

On Dec 13, 2008, at 7:52 PM, Alex Horovitz wrote:
Thoughts?


Here's Ali Ozer's perspective...

If you allow nils in collections, then you can't tell from calls such as objectForKey: or objectEqualToObject: whether the nil return indicates failure or a hit on nil. So you have to have another sentinel, which is what the lower level APIs (NSHashTable, NSMapTable) do, with the added complexity in API of course.

Sounds like the kit folks chose to keep the API simpler (at the cost of not allowing 'nil'). Not super compelling, but a design made a long time ago...

snaroff


-A

Alex
~~~~~~~~~~~~~~~~~~~~~~
Alex Horovitz
Chief Technology Officer
The Brookeside Group, Inc.

524 Main Street
Acton, MA 01720
(o) 978.266.9876 x225
(c) 978.808.0808
(f) 978.266.1555
email@hidden
www.brookeside.com
 
The Brookeside Group, Inc. - Loyalty MattersTM.

 _______________________________________________
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

References: 
 >nil in NSArray (From: Mike Schrag <email@hidden>)

  • Prev by Date: [Ann] WebObjects 2008 surveys are now available
  • Next by Date: Re: StackOverflowError in _NSWeakMutableArray?
  • Previous by thread: Re: nil in NSArray
  • Next by thread: Ajax & Firefox 3 random update problem
  • Index(es):
    • Date
    • Thread