[swift-evolution] Strings in Swift 4

Jaden Geller jaden.geller at gmail.com
Mon Jan 30 15:29:22 CST 2017


> On Jan 30, 2017, at 11:35 AM, Dave Abrahams via swift-evolution <swift-evolution at swift.org> wrote:
> 
> Why should that be out-of-bounds?  Whether it is out-of-bounds would
> depend on what items is.  If it's an array, that should be equivalent to
> 
>   let x = items[items.startIndex..<items.endIndex]

It seems to me that `items[0…]` would be equivalent to `items[0…Int.max]` if we’re going to treat `0…` as an “infinite" range, no? Otherwise, we’re either giving subscript of InfiniteRange types special behavior or we’re making subscript ignore past-the-end indices; `”hello”.characters[0…10]` would need to return the same as “hello”.characters[0…4]` to be consistent.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170130/6f50e9e8/attachment.html>


More information about the swift-evolution mailing list