[swift-evolution] modifying Array<Element> to return Element! when subscripted

Dave Abrahams dabrahams at apple.com
Tue Jun 28 13:08:32 CDT 2016


on Thu Jun 23 2016, "L. Mihalkovic via swift-evolution" <swift-evolution at swift.org> wrote:

>> On Jun 23, 2016, at 6:07 PM, Pranjal Satija via swift-evolution <swift-evolution at swift.org> wrote:
>> 
>> Would modifying array subscripts to return implicitly unwrapped
>> optionals be a bad idea? This way, if an array is indexed out of
>> bounds,
>
> Most out of bounds errors originate in bad code. So now instead of
> forcing people to rewrite it or at least have more bad code to be more
> defensive, this would give an incentive to ignore the original problem
> and never learn to code properly.

+1; I am opposed to this.  If it's not already on the list of
commonly-rejected proposals, I'm surprised, as it comes up often.

-- 
Dave



More information about the swift-evolution mailing list