<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi there Daniel,<div class=""><br class=""></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Dec 3, 2015, at 7:14 PM, Daniel Strokis &lt;<a href="mailto:dstrokis@icloud.com" class="">dstrokis@icloud.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi all,&nbsp;<div class=""><br class=""></div><div class="">In swift-corelibs-foundation/Foundation/NSArray.swift on line 347 there is a comment that says&nbsp;<span style="color: rgb(0, 132, 0); font-family: Menlo; font-size: 11px;" class="">TODO: Bounds checking</span>&nbsp;. Since that just call&nbsp;<span style="font-family: Menlo; font-size: 11px;" class="">objectAtIndex</span>, I think the bounds checking should be done inside of&nbsp;<span style="font-family: Menlo; font-size: 11px;" class="">objectAtIndex</span>. </div></div></div></blockquote><div><br class=""></div><div>Note we have another pull request open in this area too:&nbsp;<a href="https://github.com/apple/swift-corelibs-foundation/pull/15" class="">https://github.com/apple/swift-corelibs-foundation/pull/15</a></div><div><br class=""></div><div>I asked there to rebase into a single commit; once that’s done, maybe we can accept that and then move it to the implementation of objectAtIndex.</div><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">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?</div><div class=""><br class=""></div></div></div></blockquote><div><br class=""></div><div>We’ve made a decision to use fatalError(“description that makes sense”) in cases of programmer error. Obj-C Foundation would have thrown an exception (since we use ObjC exceptions exclusively for indication of programmer error there).&nbsp;</div><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">I’m super excited to be a part of this community!</div><div class=""><br class=""></div></div></div></blockquote><div><br class=""></div><div>Glad to have you here.</div><div><br class=""></div><div>- Tony</div><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Thanks,</div><div class="">Daniel Strokis</div>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=U7z7oSqRMSwdl2rYt9JJ4zIFaeg4R-2FxExg9xndDuCbzyUzMn0GtuXkJquSRoB7KlzwrnlVwDCCrOMad4IG7eBZSYWAz1HjQuAODgjDlYWjPZtOBg-2Fk-2FbKHwlIS-2BBdwCmRfxV2BwZl-2BeHeRYcmQR-2FWVYEE3mi8sC2xrehZKb7Ab-2FmllI6FdC1ZgSYY-2BKzBF4mSjf-2BrjfCm9BMVQDn-2Bl49hJv0i73KsXFW7UJMyZMUpZk-3D" alt="" width="1" height="1" border="0" style="height:1px !important;width:1px !important;border-width:0 !important;margin-top:0 !important;margin-bottom:0 !important;margin-right:0 !important;margin-left:0 !important;padding-top:0 !important;padding-bottom:0 !important;padding-right:0 !important;padding-left:0 !important;" class="">
</div>
_______________________________________________<br class="">swift-corelibs-dev mailing list<br class=""><a href="mailto:swift-corelibs-dev@swift.org" class="">swift-corelibs-dev@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-corelibs-dev<br class=""></div></blockquote></div><br class=""></div></body></html>