[swift-corelibs-dev] Bounds Checking on NSArray
dstrokis at icloud.com
Thu Dec 3 21:14:09 CST 2015
In swift-corelibs-foundation/Foundation/NSArray.swift on line 347 there is a comment that says TODO: Bounds checking . Since that just call objectAtIndex, I think the bounds checking should be done inside of objectAtIndex. My question, though, is what should be returned if the index is out of the array bounds? The methods don’t throw, so I don’t think we can raise an exception. And I don’t think we can return nil because the method is supposed to return a non-optional AnyObject. What about using assert or precondition?
I’m super excited to be a part of this community!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-corelibs-dev