<div dir="ltr">On Sun, Oct 15, 2017 at 11:59 PM, Thorsten Seitz <span dir="ltr">&lt;<a href="mailto:tseitz42@icloud.com" target="_blank">tseitz42@icloud.com</a>&gt;</span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div><div class="h5"><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" target="_blank">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="m_3231816015026111161gmail-"><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&#39;s Sequence protocol does not require the order of iteration to &quot;convey any meaning&quot;; it doesn&#39;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.  `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&#39;s your basis for saying that `elementsEqual` requires orders of iteration that &quot;convey a meaning&quot;? 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></div><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></blockquote><div><br></div><div>As I wrote above, Set cannot use a different iteration order for each iterator because it conforms to `Collection`, thereby guaranteeing a multi-pass sequence.</div></div></div></div>