<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div><br class=""></div><div><blockquote type="cite" 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 dir="auto" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div dir="auto" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">On Oct 13, 2017, at 6:52 AM, Xiaodi Wu &lt;<a href="mailto:xiaodi.wu@gmail.com" class="">xiaodi.wu@gmail.com</a>&gt; wrote:<br class=""><blockquote type="cite" class=""></blockquote><font color="#00afcd" class=""><br class=""></font><div class=""><div class=""><div dir="auto" class="">You’re welcome to bikeshed the entire API surface area of sequences and collections, but you won’t be the first to explore this area. A number of us looked into this area in the past few years and did not reach a measurable improved result.</div></div></div></div></div></div></div></blockquote><font color="#5856d6" class=""><br class=""></font>I don’t need or want to bikeshed the entire sequence and collection surface area, I just want to fix one clear and GLARING issue:<br class=""><font color="#5856d6" class=""><br class=""></font><span style="font-size: large;" class="">A Set is NOT a sequence.</span><br class=""><font color="#5856d6" class=""><br class=""></font>Note that this goes for dictionaries and any other unordered “sequences" as well.<br class=""><font color="#5856d6" class=""><br class=""></font>That was in an early draft of my original email, but I dropped it because I was afraid people would just stop reading and dismiss the idea out-of-hand without considering the problem or arguments. Apparently I should have at least put it at the bottom, so sorry if the root issue was unclear.<br class=""><font color="#5856d6" class=""><br class=""></font><blockquote type="cite" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div dir="auto" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div dir="auto" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><div class=""><div class=""><div dir="auto" class="">Sequences can be ordered or unordered,</div></div></div></div></div></div></div></blockquote><font color="#5856d6" class=""><br class=""></font>You seem to be confusing the English word “sequence” with the (current) Swift protocol “Sequence." A sequence is, by definition, ordered. Not enforcing that in a protocol does not override the English language, and as this entire thread demonstrates, causes issues further on down the line.<br class=""><font color="#5856d6" class=""><br class=""></font><blockquote type="cite" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div dir="auto" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div dir="auto" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><div class=""><div class=""><div dir="auto" class=""> single-pass or multi-pass, finite or infinite, lazy or eager. Not all the combinations of these attributes make sense, but many do. For each combination, a different subset of the sequence algorithms are “useful.” As an example, “last” is not great for an infinite sequence. </div></div></div></div><div class=""><div class=""><div class=""><div dir="auto" class="">It’s possibly also not what you want for a single-pass sequence.</div></div></div></div></div></div></div></blockquote><font color="#5856d6" class=""><br class=""></font>All of those actually are *sequences*, so it's essentially irrelevant to this discussion about not-sequences that conform to Sequence anyway.<br class="">&nbsp;That said, because they are all sequences, there are still a few rational behaviors that make logical sense. An infinite loop or nil for infinite.last both make sense to me, and it IS what you want for a single-pass set, IMO it's a programmer error if the user calls last and they didn't want to burn the set.<br class=""><font color="#5856d6" class=""><br class=""></font><blockquote type="cite" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div dir="auto" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div dir="auto" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><div class=""><div dir="auto" class="">Now, as to the problem discussed here. It’s an orthogonal problem to what you are discussing because, whether or not you reorganize the protocols entirely, there is still going to be confusion about how exactly “elementsEqual” differs from “==“ even for an ordered sequence. The name is clearly problematic in that respect. However, I would argue that the behavior of the method isn’t “improper” and the behavior is not “badly defined.”</div></div></div></div></div></div></blockquote><font color="#5856d6" class=""><br class=""></font>Sure, `elementsEqual` isn't perfect, but it's a hell of a lot better than `lexicographicallyEquals`. And once you restrict Sequence to properly ordered sets, it makes a lot more sense. The problem is a function that compares elements "in the same order" when one or both of the sequences doesn't HAVE an order.<br class=""><font color="#5856d6" class=""><br class=""><br class=""></font><blockquote type="cite" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div dir="auto" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div dir="auto" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><font color="#00afcd" class=""><br class=""></font>On Fri, Oct 13, 2017 at 07:09 Benjamin G &lt;<a href="mailto:benjamin.garrigues@gmail.com" target="_blank" class="">benjamin.garrigues@gmail.com</a>&gt; wrote:<br class=""><blockquote type="cite" class=""><div class=""><div class=""><div class=""><div class="gmail_quote">+1 on both points. As for your solutions, i see 1/ as the best solution. Breaking source code that rely on badly defined, or improper behavior isn't "breaking".&nbsp; You don't break something that's already half broken.<br class="">As an app developer relying on swift on my day to day job and making a living of it, i want to emphasis this: I really don't mind if a language version change is making me look more carefully on some parts of my code that i probably had overlooked.&nbsp;<br class="">Sure i may pester a bit when the code doesn't compile, but it sure is better than discovering the weird behavior of a badly defined protocol hierarchy in customer support.<br class=""><br class=""><br class="">On Fri, Oct 13, 2017 at 6:57 AM, Kevin Nattinger via swift-evolution <span class="">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>&gt;</span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="gmail_extra"><div class="gmail_quote"></div></div><div class="gmail_extra"><div class="gmail_quote">–∞<br class=""><br class="">1. I strongly object to the proposed name. It doesn't make it more clear to me what the method does, and is misleading at best. Among other issues, "lexicographical" is defined as alphabet order, and (1) this method applies to objects that are not Strings, and (2) this method's behavior isn't any more well-defined for Strings, so that name is even more of a lie than the original.<br class=""><br class="">2. This is really just a symptom of a bigger problem. The fact that two Sets can compare equal and yet return different results for that method (among too many others) is logically inconsistent and points to a much deeper issue with Set and Sequence. It is probably about 3 releases too late to get this straightened out properly, but I'll outline the real issue in case someone has an idea for fixing it.<br class=""><br class=""><b class="">The root of the problem&nbsp;is&nbsp;that&nbsp;Set conforms to Sequence, but Sequence doesn't require a well-defined order.</b> Since Set doesn't have a well-defined order, a significant portion of its&nbsp;interface&nbsp;is unspecified. The methods are implemented because they have to be, but they doesn't have well-defined or necessarily consistent results.<br class=""><br class="">A sequence&nbsp;is, by definition,&nbsp;ordered. That&nbsp;is&nbsp;reflected&nbsp;in&nbsp;the fact that over half the methods&nbsp;in&nbsp;the main Sequence definition*&nbsp;make no sense and are not well-defined unless there&nbsp;is&nbsp;a&nbsp;well-defined order to the sequence itself. What does it even mean to `dropFirst()`&nbsp;in&nbsp;a&nbsp;Set? The fact that two objects that compare equal can give different results&nbsp;for&nbsp;a&nbsp;100%&nbsp;deterministic function is illogical, nonsensical, and dangerous.<br class=""><br class="">*&nbsp;7/12&nbsp;by my count, ignoring `_*` funcs but&nbsp;including the `var`<br class=""><br class="">The current contents of Sequence can be cleanly divided into two groups; those that&nbsp;return&nbsp;SubSequence imply a specific ordering, and the rest&nbsp;do&nbsp;not.<br class=""><br class="">&nbsp;I think those&nbsp;should be/should&nbsp;have been two separate protocols:<br class=""><br class=""><span class="" style="color: rgb(233, 175, 205); font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures;">public</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"> </span><span class="" style="color: rgb(233, 175, 205); font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures;">protocol</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"> </span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);">Iterable</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"> {</span><br class=""><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);">&nbsp;&nbsp;</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(205, 121, 35);">associatedtype</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"> Iterator</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">:</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"> </span><span class="" style="color: rgb(52, 188, 38); font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures;">IteratorProtocol</span><br class=""><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);">&nbsp;&nbsp;</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">func</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"> </span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);">map</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">&lt;</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);">T</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">&gt;</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);">(</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);">...</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);">) </span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">-&gt;</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"> </span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">[</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(52, 188, 38);">T</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">]</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"> </span><span class="" style="color: rgb(130, 185, 255); font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures;">// Iterable where .Iterator.Element == T</span><br class=""><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);">&nbsp;&nbsp;</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">func</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"> </span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);">filter</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);">(</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);">...</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);">) </span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">-&gt;</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"> </span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">[</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(52, 188, 38);">Iterator.Element</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">]</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"> </span><span class="" style="color: rgb(130, 185, 255); font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures;">// Iterable where .Iterator.Element == Self.Iterator.Element</span><br class=""><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);">&nbsp;&nbsp;</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">func</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"> </span><span class="" style="color: rgb(52, 187, 200); font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures;">forEach</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);">(</span><span class="" style="color: rgb(52, 187, 200); font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures;">...</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);">)</span><br class=""><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);">&nbsp;&nbsp;</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">func</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"> </span><span class="" style="color: rgb(52, 187, 200); font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures;">makeIterator</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);">() </span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">-&gt;</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"> </span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(52, 188, 38);">Iterator</span><br class=""><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);">&nbsp;&nbsp;</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">var</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"> </span><span class="" style="color: rgb(52, 187, 200); font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures;">underestimatedCount</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">:</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"> </span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(52, 188, 38);">Int</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"> { </span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(205, 121, 35);">get</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"> }</span><br class=""><span style="color: rgb(214, 214, 214); font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961);" class="">}</span><br class=""><font color="#d6d6d6" face="Andale Mono" class=""><br class=""></font><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><div class=""><div class=""><div style="margin:0px;line-height:normal;font-family:'Andale Mono';color:rgb(214,214,214);background-color:rgba(0,0,0,0.901961);min-height:14px" class=""><span style="font-variant-ligatures:no-common-ligatures" class=""></span></div></div></div></div></blockquote><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">public</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"> </span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">protocol</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"> </span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);">Sequence</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">:</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"> </span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(52, 188, 38);">Iterable</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"> { </span><span class="" style="color: rgb(130, 185, 255); font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures;">// Maybe OrderedSequence just to make the well-defined-order requirement explicit</span><br class=""><span class="" style="color: rgb(214, 214, 214); font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures;">&nbsp;&nbsp;</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(205, 121, 35);">associatedtype</span><span class="" style="color: rgb(214, 214, 214); font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures;"> SubSequence</span><br class=""><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);">&nbsp;&nbsp;</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">func</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"> </span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);">dropFirst</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);">(</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);">...</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);">) &nbsp; </span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">-&gt;</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"> </span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(52, 188, 38);">SubSequence</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"> &nbsp; </span><span class="" style="color: rgb(130, 185, 255); font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures;">// Sequence where .Iterator.Element == Self.Iterator.Element</span><br class=""><span class="" style="color: rgb(214, 214, 214); font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures;">&nbsp;&nbsp;</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">func</span><span class="" style="color: rgb(214, 214, 214); font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures;"> </span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);">dropLast</span><span class="" style="color: rgb(214, 214, 214); font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures;">(</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);">...</span><span class="" style="color: rgb(214, 214, 214); font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures;">)&nbsp; &nbsp; </span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">-&gt;</span><span class="" style="color: rgb(214, 214, 214); font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures;"> </span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(52, 188, 38);">SubSequence</span><span class="" style="color: rgb(214, 214, 214); font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures;"> &nbsp; </span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(130, 185, 255);">//&nbsp; &nbsp; " "</span><br class=""><span class="" style="color: rgb(214, 214, 214); font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures;">&nbsp;&nbsp;</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">func</span><span class="" style="color: rgb(214, 214, 214); font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures;"> </span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);">drop</span><span class="" style="color: rgb(214, 214, 214); font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures;">(</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(205, 121, 35);">while</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);">...</span><span class="" style="color: rgb(214, 214, 214); font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures;">) &nbsp; </span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">-&gt;</span><span class="" style="color: rgb(214, 214, 214); font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures;"> </span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(52, 188, 38);">SubSequence</span><span class="" style="color: rgb(214, 214, 214); font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures;"> &nbsp; </span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(130, 185, 255);">//&nbsp; &nbsp; " "</span><br class=""><span class="" style="color: rgb(214, 214, 214); font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures;">&nbsp;&nbsp;</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">func</span><span class="" style="color: rgb(214, 214, 214); font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures;"> </span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);">prefix</span><span class="" style="color: rgb(214, 214, 214); font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures;">(</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);">...</span><span class="" style="color: rgb(214, 214, 214); font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures;">)&nbsp; &nbsp; &nbsp; </span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">-&gt;</span><span class="" style="color: rgb(214, 214, 214); font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures;"> </span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(52, 188, 38);">SubSequence</span><span class="" style="color: rgb(214, 214, 214); font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures;"> &nbsp; </span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(130, 185, 255);">//&nbsp; &nbsp; " "</span><br class=""><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);">&nbsp;&nbsp;</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">func</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"> </span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);">prefix</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);">(</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(205, 121, 35);">while</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);">...</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);">) </span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">-&gt;</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"> </span><span class="" style="color: rgb(52, 188, 38); font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures;">SubSequence</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"> &nbsp; </span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(130, 185, 255);">//&nbsp; &nbsp; " "</span><br class=""><span class="" style="color: rgb(214, 214, 214); font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures;">&nbsp;&nbsp;</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">func</span><span class="" style="color: rgb(214, 214, 214); font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures;"> </span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);">suffix</span><span class="" style="color: rgb(214, 214, 214); font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures;">(</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);">...</span><span class="" style="color: rgb(214, 214, 214); font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures;">)&nbsp; &nbsp; &nbsp; </span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">-&gt;</span><span class="" style="color: rgb(214, 214, 214); font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures;"> </span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(52, 188, 38);">SubSequence</span><span class="" style="color: rgb(214, 214, 214); font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures;"> &nbsp; </span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(130, 185, 255);">//&nbsp; &nbsp; " "</span><br class=""><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);">&nbsp;&nbsp;</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">func</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"> </span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);">split</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);">(</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); color: rgb(52, 187, 200);">...</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(205, 121, 35);">where</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);">...</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);">)&nbsp; </span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">-&gt;</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"> </span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">[</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(52, 188, 38);">SubSequence</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">]</span><span class="" style="font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"> </span><span class="" style="color: rgb(130, 185, 255); font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961); font-variant-ligatures: no-common-ligatures;">// Iterable where .Iterator.Element == (Sequence where .Iterator.Element == Self.Iterator.Element)</span><br class=""><span style="color: rgb(214, 214, 214); font-family: 'Andale Mono'; background-color: rgba(0, 0, 0, 0.901961);" class="">}</span><br class=""><br class="">(The comments, of course, would be more sensible types once the ideas can actually be expressed&nbsp;in&nbsp;Swift)<br class=""><br class="">Then unordered collections (Set and Dictionary) would just conform to Iterable and not Sequence, so ALL the methods on those classes would make logical sense and have&nbsp;well-defined behavior; no change would be needed&nbsp;for&nbsp;ordered collections.<br class=""><br class="">Now, the practical matter. If this were Swift&nbsp;1-&gt;2&nbsp;or&nbsp;2-&gt;3, I doubt there would be a significant issue with actually making this change. Unfortunately, we're well beyond&nbsp;that and making a change this deep&nbsp;is&nbsp;an&nbsp;enormous deal. So I see two ways forward.<br class=""><br class="">1. We could go ahead and make this separation. Although it's a potentially large breaking change, I would argue that because the methods are ill-defined anyway, the&nbsp;breakage&nbsp;is&nbsp;justified&nbsp;and a net benefit.<br class=""><br class="">2. We could&nbsp;try&nbsp;and think of a way to make the distinction between ordered and unordered&nbsp;"sequences"&nbsp;in&nbsp;a less-breaking manner. Unfortunately, I don't have a good&nbsp;suggestion&nbsp;for&nbsp;this, but&nbsp;if&nbsp;anyone has ideas, I'm all ears. Or eyes,&nbsp;as&nbsp;the&nbsp;case&nbsp;may be.<br class=""><br class=""><br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><div class=""><div class=""><div class="">On Oct 12, 2017, at 4:24 PM, Xiaodi Wu via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>&gt; wrote:<br class=""><blockquote type="cite" class=""></blockquote><font color="#12c00e" class=""><br class=""></font>Rename <code class="">Sequence.elementsEqual</code><br class=""><blockquote type="cite" class=""><div class=""><div class=""><span class="">
Proposal: <a href="https://gist.github.com/xwu/NNNN-rename-elements-equal.md" target="_blank" class="">SE-NNNN</a><br class="">Authors: <a href="https://github.com/xwu" target="_blank" class="">Xiaodi Wu</a><br class="">Review Manager: TBD<br class="">Status: <strong class="">Awaiting review</strong><br class=""></span></div></div></blockquote>Introduction<br class="">The current behavior of <code class="">Sequence.elementsEqual</code> is 
potentially confusing to users given its name. Having surveyed the 
alternative solutions to this problem, it is proposed that the method be
 renamed to <code class="">Sequence.lexicographicallyEquals</code>.<br class=""><div class=""><div class=""><span class=""><h2 class=""><a href="https://gist.github.com/xwu/1f0ef4e18a7f321f22ca65a2f56772f6#introduction" class="m_-8318953893838690629m_-6746564519493216477m_7432166097604328613gmail-anchor" id="m_-8318953893838690629m_-6746564519493216477m_7432166097604328613gmail-user-content-introduction" target="_blank"></a></h2></span><div class="">[...]</div></div></div></div></div></div></div></blockquote><br class=""></div></div><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"></blockquote>_______________________________________________<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"></blockquote>swift-evolution mailing list<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
</blockquote><a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a><br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
</blockquote><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="">
<br class=""></div></div></blockquote></div></div></div>
</div></blockquote></div></div></div></div></blockquote></div><br class=""></body></html>