<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div></div><div><br></div><div><br>Am 16.10.2017 um 00:46 schrieb Xiaodi Wu &lt;<a href="mailto:xiaodi.wu@gmail.com">xiaodi.wu@gmail.com</a>&gt;:<br><br></div><blockquote type="cite"><div><div dir="ltr">On Sun, Oct 15, 2017 at 2:39 PM, Kevin Nattinger <span dir="ltr">&lt;<a href="mailto:swift@nattinger.net" target="_blank">swift@nattinger.net</a>&gt;</span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><div><blockquote type="cite"><div><div dir="auto" style="text-align:start;text-indent:0px"><font color="#000000">[…]</font></div><span class="gmail-"><div dir="auto" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">Swift's Sequence protocol does not require the order of iteration to "convey any meaning"; it doesn't even require it to be deterministic.</div><div dir="auto" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br></div><blockquote class="gmail_quote" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><div></div></div></blockquote></span></div></blockquote><br>And that’s EXACTLY why none of the functions on Sequence should rely on the order conveying meaning. &nbsp;`ElementsEqual` (for example) DOES rely on the order of iteration conveying a meaning not required by the protocol, and renaming it `lexicographicallyEquals` does not change that fact. Either Sequence needs to require a meaningful order or `elementsEqual` should be moved to a protocol that does.</div></div></blockquote><div><br></div><div>What's your basis for saying that `elementsEqual` requires orders of iteration that "convey a meaning"? It merely answers the question of whether iterating over `a` is substitutable for iterating over `b`, a question applicable to instances of any type which offers iterated access.</div><div><br></div></div></div></div>
</div></blockquote><br><div>As Set has no intrinsic order of elements just imagine it was implemented to have each iterator created on it to iterate in a random order. This would satisfy the Sequence protocol (or rather its Iterable part hich should be split off) and clearly show that the order is meaningless for Sets.</div><div><br></div><div>-Thorsten</div></body></html>