<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></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 15 Mar 2017, at 19:40, Nate Cook via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Hi Nick,</div><div class=""><br class=""></div><div class="">I think this might have come up in an earlier thread, but clamped(to:) with a half-open range argument brings up the question of how to clamp to an empty range. As proposed, the implementation of this method would result in an error when passed an empty range:</div><div class=""><br class=""></div><div class=""><font face="Menlo" class=""> foo.clamped(to: 0..<0)</font></div><div class=""><font face="Menlo" class=""> // fatal error: Can't form Range with upperBound < lowerBound</font></div><div class=""><br class=""></div><div class="">Is that the desired behavior? Providing documentation for both new methods would help make it clear what the expected functionality is.</div></div></div></blockquote></div><br class=""><div class="">I'd say that's the correct behaviour; it makes no sense to call a clamp method without anything to actually clamp to; an empty range contains nothing, so not only can't include the value you're testing against, but also has no bounds to clamp to instead.</div></body></html>