<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div><br><br>Sent from my iPad</div><div><br>On Jan 23, 2017, at 9:50 AM, Ben Cohen &lt;<a href="mailto:ben_cohen@apple.com">ben_cohen@apple.com</a>&gt; wrote:<br><br></div><blockquote type="cite"><div><meta http-equiv="Content-Type" content="text/html charset=utf-8"><br class=""><div><blockquote type="cite" class=""><div class="">On Jan 22, 2017, at 9:54 PM, FĂ©lix Cloutier &lt;<a href="mailto:felixcca@yahoo.ca" class="">felixcca@yahoo.ca</a>&gt; 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=""><br class=""><blockquote type="cite" class=""><div class=""><div dir="auto" class=""><div class=""><blockquote type="cite" class=""><div class=""><div class="">doesn't necessarily mean that ignoring that case is the right thing to do. In fact, it means that Unicode won't do anything to protect programs against these, and if Swift doesn't, chances are that no one will. Isolated combining characters break a number of expectations that developers could reasonably have:</div><div class=""><br class=""></div><div class=""><ul class="MailOutline"><li class="">(a + b).count == a.count + b.count</li><li class="">(a + b).startsWith(a)</li><li class="">(a + b).endsWith(b)</li><li class="">(a + b).find(a) // or .find(b)</li></ul><div class=""><br class=""></div></div><div class="">Of course, this can be documented, but people want easy, and documentation is hard.</div></div></blockquote><div class=""><br></div></div></div></div></blockquote></div></div></div></blockquote></div></div></blockquote><div><blockquote type="cite"><div><div><div>These rules, while intuitive for some collections like <font face="Menlo" class="">Array</font>, are not documented requirements of <font face="Menlo" class="">RangeReplaceableCollection &amp; Equatable</font> on which they rely.</div></div></div></blockquote><div><br></div><div><span style="background-color: rgba(255, 255, 255, 0);">While I agree wholeheartedly with the gist Ben's response here, I feel the need to clarify one thing:</span></div><div><span style="background-color: rgba(255, 255, 255, 0);"><br></span></div><div><span style="background-color: rgba(255, 255, 255, 0);">The documentation doesn't have to spell out every possible law (theorem) explicitly as long as it is implied by what is documented (the axioms). &nbsp;For example,</span></div><div><span style="background-color: rgba(255, 255, 255, 0);"><br></span></div><div><span style="background-color: rgba(255, 255, 255, 0);">&nbsp; &nbsp; a.startsWith(a)</span></div><div><span style="background-color: rgba(255, 255, 255, 0);"><br></span></div><div><span style="background-color: rgba(255, 255, 255, 0);">is a law, and it's implied by this documentation:</span></div><div><span style="background-color: rgba(255, 255, 255, 0);"><br></span></div><div><div style="text-indent: 0px;"><a class="toggle-link" data-toggle="collapse" href="http://swiftdoc.org/v3.0/protocol/Sequence/#comment-func-iterator-element_-equatable-starts-with_" style="box-sizing: border-box; text-decoration: none; outline: 0px; line-height: 18px; display: inline-block; margin-left: 25px; text-indent: -25px; background-color: rgba(255, 255, 255, 0); background-position: 0px 0px;"><font color="#000000">func&nbsp;<span class="identifier" style="box-sizing: border-box;">starts</span>(<wbr style="box-sizing: border-box;">with:)</font></a></div><div class="comment collapse in" id="comment-func-iterator-element_-equatable-starts-with_" style="box-sizing: border-box; margin: 0px; line-height: 1.4em;"><div class="p" style="box-sizing: border-box; padding: 0px 0px 15px 25px;"><p style="box-sizing: border-box; margin: 10px 0px;"><span style="background-color: rgba(255, 255, 255, 0);">Returns a Boolean value indicating whether the initial elements of the sequence are the same as the elements in another sequence.</span></p></div></div></div><div>If for some reason the rules above are not the inevitable consequence of documented semantics of RangeReplaceableCollection where Iterator.Element : Equatable, that is a bug. &nbsp;</div></div></body></html>