<div><br><div class="gmail_quote"><div>On Tue, 17 Oct 2017 at 21:00, Jonathan Hull via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><blockquote type="cite"><div>On Oct 17, 2017, at 11:47 AM, Michael Ilseman via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:</div><br class="m_-1627342453204751593Apple-interchange-newline"><div><span 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;float:none;display:inline!important">`==` conveys substitutability of the two Sequences. This does not necessarily entail anything about their elements, how those elements are ordered, etc., it just means two Sequences are substitutable. `elementsEqual` means that the two Sequences produce substitutable elements. These are different concepts and both are independently useful.</span></div></blockquote></div><br></div><div style="word-wrap:break-word"><div>I agree that ‘==‘ conveys substitutability.  Here is the issue:</div><div><br></div><div><span class="m_-1627342453204751593Apple-tab-span" style="white-space:pre-wrap">        </span>let a = Set([1,2,3,4,5])</div><div><span class="m_-1627342453204751593Apple-tab-span" style="white-space:pre-wrap">        </span>let b = Set([5,4,3,2,1])</div><div><br></div><div><span class="m_-1627342453204751593Apple-tab-span" style="white-space:pre-wrap">        </span>a == b //True, they are substitutable</div><div><br></div><div><span class="m_-1627342453204751593Apple-tab-span" style="white-space:pre-wrap">        </span>[1,2,3,4,5].elementsEqual(a) //True</div><div><span class="m_-1627342453204751593Apple-tab-span" style="white-space:pre-wrap">        </span>[1,2,3,4,5].elementsEqual(b) //False… I guess they weren’t actually substitutable after all</div><div><br></div><div><br></div><div>Thanks,</div><div>Jon</div></div>_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
</blockquote></div></div><div dir="auto"><br></div><div dir="auto">I read along with most of the thread and like to add one thing. Maybe it’s not the right way to look at things, but I see protocol extensions as being part of any type that conforms to the protocol. As it is now, code completion on a Set will present me with the elementsEqual function, which in my view is misleading, since it cannot be used in any useful way with a Set.</div><div dir="auto"><br></div><div dir="auto">By renaming elementsEqual we might be able to make it less misleading, but it will always be a useless function that is part of the Set namespace (or Dictionary for that matter).</div><div dir="auto"><br></div><div dir="auto">I don’t know what the best solution would be, but to me it feels like distinguishing between Iterable and Sequence, or Ordered and Unordered makes sense, and it might be good to at least investigate what the impact would be.</div><div dir="auto"><br></div><div dir="auto">Regards,</div><div dir="auto">/Manolo</div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><br></div>