<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Mar 1, 2016, at 2:00 AM, Haravikk <<a href="mailto:swift-evolution@haravikk.me" class="">swift-evolution@haravikk.me</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">I still wonder if a better solution might involve the same syntax as ranges currently benefit from, i.e:</div><div class=""><br class=""></div><div class=""><font face="Monaco" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>0 ..< 10 // [0, 10) with an increment of 1</font></div><div class=""><font face="Monaco" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>(0 … 10).stride(2) // [0, 10] with an increment of 2</font></div><div class=""><br class=""></div><div class="">The most important change is that the default type for this should be able to handle higher starting indices, e.g:</div><div class=""><br class=""></div><div class=""><font face="Monaco" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>(10 … 0).stride(2) // [10, 0] with a decrement of 2</font></div><div class=""><br class=""></div><div class="">Basically I don’t like the stride global function in the first place =)</div><div class=""><br class=""></div><div class="">The benefit of the Range syntax is that it’s clear whether the end point is inclusive or exclusive, and it’s nice and succinct. The problem right now is just that ranges have a limit on the direction they can be traversed in for things like accessing slices of collections, in which case we’ll need to make sure that these still retain the same limitation.</div><br class=""></div></div></blockquote><br class=""></div><div>This would have to be a separate proposal to allow descending ranges. I think that would be a good addition to the language and encourage you to write it.</div><div><br class=""></div><div>-- E</div><div><br class=""></div><br class=""></body></html>