> On Jan 20, 2017, at 2:45 PM, Dave Abrahams via swift-evolution 
> <[email protected]> wrote:
> 
> on Fri Jan 20 2017, Joe Groff <[email protected]> wrote:
> 
>> Jordan points out that the generalized slicing syntax stomps on '...x'
>> and 'x...', which would be somewhat obvious candidates for variadic
>> splatting if that ever becomes a thing. Now, variadics are a much more
>> esoteric feature and slicing is much more important to day-to-day
>> programming, so this isn't the end of the world IMO, but it is
>> something we'd be giving up.
> 
> Good point, Jordan.

In my experiments with introducing one-sided operators in Swift 3, I was not 
able to find a case where you actually wanted to write `c[i...]`. Everything I 
tried needed to use `c[i..<]` instead. My conclusion was that there was no 
possible use for postfix `...`; after all, `c[i...]` means `c[i...c.endIndex]`, 
which means `c[i..<c.index(after: c.endIndex)]`, which violates a precondition 
on `index(after:)`.

If that's the case, you can reserve postfix `...` for future variadics 
features, while using prefix `...` for these one-sided ranges.

(Unless you're saying there should be no postfix `..<`, only postfix `...`. But 
that's not really consistent with the idea that a missing bound is replaced by 
the appropriate bound of the collection.)

-- 
Brent Royal-Gordon
Architechies

_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to