<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div><div style="direction: inherit;"><div style="direction: inherit;"><span style="background-color: rgba(255, 255, 255, 0);">I have the impression we exchanged flexibility for correctness (the ability to represent 0..&lt;Int.max) and that it's wasn't worth the loss of flexibility.1</span></div><div style="direction: inherit;"><span style="background-color: rgba(255, 255, 255, 0);"><br></span></div><div style="direction: inherit;"><span style="background-color: rgba(255, 255, 255, 0);">Or am I missing something?</span></div></div></div><div><br>On 6 Sep 2016, at 08:15, David Hart via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>&gt; wrote:<br><br></div><blockquote type="cite"><div><meta http-equiv="Content-Type" content="text/html charset=utf-8">Hi people,<div class=""><br class=""></div><div class="">I’ve recently started migrating some Swift 2 projects to Swift 3. I came across the split of Range into Range and ClosedRange and I’ve really struggled with it. Specifically, in Swift 2, I had a struct with a Range property that was initialised in many places with either a closed or open range:</div><div class=""><br class=""></div><div class=""><div class=""><font face="Menlo" class="">struct Day { … }</font></div><div class=""><font face="Menlo" class="">struct Day : Comparable { … }</font></div><div class=""><font face="Menlo" class="">struct Day : Strippable { … }</font></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><font face="Menlo" class="">struct Info {</font></div><div class=""><font face="Menlo" class="">&nbsp; &nbsp; let name: String</font></div><div class=""><font face="Menlo" class="">&nbsp; &nbsp; let range: Range&lt;Day&gt;</font></div><div class=""><font face="Menlo" class="">}</font></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><font face="Menlo" class="">Info(name: "Christmas Vacation", range: twentyfith...thirtyfirst)</font></div><div class=""><font face="Menlo" class="">Info(name: "Summer Vacation", range: someday..&lt;otherday)</font></div></div><div class=""><br class=""></div><div class="">Now, in Swift 3, it seems like we’ve lost a type to represent any range to allow an API client the flexibility to specify it as he wishes. Is there a solution to this problem through a protocol which both ranges conform to, or are we stuck with this because of the new API?</div><div class=""><br class=""></div><div class=""><font face="Menlo" class="">protocol RangeType {<br class="">&nbsp; &nbsp; associatedtype Bounds<br class="">&nbsp; &nbsp; let lowerBound: Bound { get }<br class="">&nbsp; &nbsp; let upperBound: Bound { get }<br class="">&nbsp; &nbsp; // what else? not even sure if it is possible to define such a protocol<br class="">}</font></div><div class=""><br class=""></div><div class="">David.</div></div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>swift-evolution mailing list</span><br><span><a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a></span><br><span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br></div></blockquote></body></html>