<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 18 Apr 2017, at 15:29, Matt Lewin via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><span style="font-size: 14px;" class=""><br class=""></span></div><div class=""><span style="font-size: 14px;" class="">In contrast, the proposed solution of </span></div><div class=""><pre style="box-sizing: border-box; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; margin-top: 0px; margin-bottom: 0px; line-height: 1.45; word-wrap: normal; padding: 16px; overflow: auto; background-color: rgb(246, 248, 250); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-break: normal; color: rgb(36, 41, 46);" class=""><span style="font-size: 14px;" class=""><span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">//</span> half-open right-handed range</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">let</span> greeting <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">=</span> s[<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">..<</span>i]
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">//</span> closed right-handed range</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">let</span> withComma <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">=</span> s[<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">...</span><span class="pl-smi" style="box-sizing: border-box; color: rgb(51, 51, 51);">i</span>]
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"><span class="pl-c" style="box-sizing: border-box;">//</span> left-handed range (no need for half-open variant)</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);"></span><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">let</span> location <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">=</span> s[i<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">...</span>]</span></pre><div class=""><span style="font-size: 14px;" class="">requires both the code-writer and the code-reader to infer the missing side is the start or end.</span></div></div><div class=""><span style="font-size: 14px;" class=""><br class=""></span></div><div class=""><span style="font-size: 14px;" class="">From my perspective, this obfuscates the language by reducing the ability of the code to be read as English. (One of the goals of Swift design, correct?)</span></div></div></div></blockquote><br class=""></div><div>I mentioned in an earlier reply that my preference would be to retain use of the binary operator and use Void as the open end like so:</div><div><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div><span style="font-family: Monaco;" class="">func ... <T:Comparable>(lhs:T, rhs:Void) -> PartialRangeFrom<T> { … }</span></div><div class=""><font face="Monaco" class="">func ... <T:Comparable>(lhs:Void, rhs:T) -> PartialRangeTo<T> { … }</font></div><div class=""><font face="Monaco" class=""><br class=""></font></div><div class=""><font face="Monaco" class="">let rangeFrom = 5...()</font></div><div class=""><font face="Monaco" class="">let rangeTo = ()...5</font></div><div class=""><font face="Monaco" class=""><br class=""></font></div></blockquote>Would that solve your concern? Ideally we could also push for underscore to become another alias for Void when used in such a context, so we could do:<div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class=""><div class=""><font face="Monaco" class="">let rangeFrom = 5..._</font></div></div><div class=""><div class=""><font face="Monaco" class="">let rangeTo = _...5</font></div></div><div class=""><font face="Monaco" class=""><br class=""></font></div></blockquote>This to me is a bit more explicit that one end of the range being left open on purpose. I initially considered some kind of other symbol, but I think Void/underscore is suitable enough, underscore especially as it's consistent with other features.</body></html>