Add accessor with bounds check to Array

Safety can be thought of in tiers -- trapping is safer than reaching into out-of-bounds memory, but returning nil is even safer than trapping, requiring the programmer to consciously deal with the optionality at the call site instead of implicitly crashing. Swift.org - About Swift explicitly references optionals as a safety feature, so I don't feel that it's a stretch to call this the safer version of the API.

3 Likes