<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Oct 13, 2017, at 1:34 PM, Howard Lovatt via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="content-type" content="text/html; charset=utf-8" class=""><div dir="auto" class="">I am very glad that this issue is getting some air time since the ‘loose’ definitions in `Sequence` are a pain. <div class=""><br class=""></div><div class="">I am in the camp that thinks the best solution is to split `Sequence`. I would propose splitting into `Iterable` and `Sequence`, `Sequence` is ordered. `Set` and `Dictionary` would implement `Iterable` and a `for` loop would work with `Iterable`. That way only already broken code is affected. <div class=""><br class=""></div><div class="">At present we have `Set` and `Dictionary` that are problems in the standard library and this justifies the split. </div><div class=""><br class=""></div><div class="">If other collection types are added to the standard library that require further sub-division of sequence then split sequence further at that time. <br class=""></div></div></div></div></blockquote>Unfortunately there already ‘other’ collections in the standard library, as Xiaodi points out, lazy collections, eager collections, finite collections, infinite collections…</div><div>Splitting Sequence is almost trivial, handling the consequences of this split downstream (in more refined protocols) is a problem.</div><div><br class=""></div><div>Max</div><div><br class=""><blockquote type="cite" class=""><div class=""><div dir="auto" class=""><div class=""><div class=""><br class=""><div class="">-- Howard. </div><div class=""><br class="">On 14 Oct 2017, at 6:41 am, Jonathan Hull via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:<br class=""><br class=""></div><blockquote type="cite" class=""><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class="">I would also expect lexicographicallyEquals to sort the elements (or otherwise create/reference a total ordering) before checking for equality. I would be more surprised by the behavior of a function named this than elementsEqual.<div class=""><br class=""></div><div class="">Given the name, I would expect elementsEqual to return true if two sequences have the same elements, regardless of ordering (this would be a valuable function IMHO). I would expect lexicographicallyEquals to compare the elements in some lexicographical order defined for the type which overrides the internal ordering of the sequence.</div><div class=""><br class=""></div><div class="">Kevin is right… the real answer is that the actual intended function really shouldn’t exist on unordered sequences.</div><div class=""><div class=""><br class=""></div><div class="">Thanks,</div><div class="">Jon<br class=""><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Oct 13, 2017, at 10:12 AM, Kevin Nattinger via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div 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; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" class=""><div class=""><br class="Apple-interchange-newline">On Oct 13, 2017, at 10:01 AM, Michael Ilseman <<a href="mailto:milseman@apple.com" class="">milseman@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><br class="Apple-interchange-newline"><br class="" 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; -webkit-text-stroke-width: 0px;"><blockquote type="cite" class="" 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; -webkit-text-stroke-width: 0px;"><div class="">On Oct 12, 2017, at 9:57 PM, Kevin Nattinger via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class="">–∞</div><div class=""><br class=""></div>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.<div class=""><br class=""></div></div></div></blockquote><div class="" 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; -webkit-text-stroke-width: 0px;"><br class=""></div><div class="" 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; -webkit-text-stroke-width: 0px;">FWIW, in the context of String, "lexicographical ordering” does not imply human-written-language-alphabetical order at all, as there’s no universal alphabetical ordering for human language. I.e., such a concrete notion for Strings does not exist, not even theoretically. “Lexicographical” derives its meaning from the mathematical usage[1] which uses that term as well as “alphabet” without being restricted to human-written-language, in which it means some total ordering over a finite set.</div><div class="" 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; -webkit-text-stroke-width: 0px;"><br class=""></div><div class="" 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; -webkit-text-stroke-width: 0px;">[1] <a href="https://en.wikipedia.org/wiki/Lexicographical_order" class="">https://en.wikipedia.org/wiki/Lexicographical_order</a></div></div></blockquote><div class=""><br class=""></div>I see, apologies for the mistake. </div><div 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; -webkit-text-stroke-width: 0px;" class="">Regardless of the specific type of ordering, lexicographicallyEquals says to me that the objects should be sorted into lexicographical order and compared. Precisely the opposite of the proposal.</div><div 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; -webkit-text-stroke-width: 0px;" class=""><br class=""><blockquote type="cite" class=""><div class=""><br class="" 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; -webkit-text-stroke-width: 0px;"><blockquote type="cite" class="" 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; -webkit-text-stroke-width: 0px;"><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><div 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.</div><div class=""><br class=""></div><div class=""><b class="">The root of the problem is that Set conforms to Sequence, but Sequence doesn't require a well-defined order.</b><span class="Apple-converted-space"> </span>Since Set doesn't have a well-defined order, a significant portion of its interface 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 is, by definition, ordered. That is reflected in the fact that over half the methods in the main Sequence definition* make no sense and are not well-defined unless there is a well-defined order to the sequence itself. What does it even mean to `dropFirst()` in a Set? The fact that two objects that compare equal can give different results for a 100% deterministic function is illogical, nonsensical, and dangerous.</div><div class=""><br class=""></div><div class="">* 7/12 by my count, ignoring `_*` funcs but including the `var`<br class=""><br class="">The current contents of Sequence can be cleanly divided into two groups; those that return SubSequence imply a specific ordering, and the rest do not.</div><div class=""><br class=""></div><div class=""> I think those should be/should have been two separate protocols:</div><div class=""><br class=""></div><div class=""><div class="" style="margin: 0px; line-height: normal; font-family: 'Andale Mono'; color: rgb(233, 175, 205); background-color: rgba(0, 0, 0, 0.901961);"><span class="" style="font-variant-ligatures: no-common-ligatures;">public</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"><span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures;">protocol</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"><span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);">Iterable</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"><span class="Apple-converted-space"> </span>{</span></div><div class="" style="margin: 0px; line-height: normal; font-family: 'Andale Mono'; color: rgb(52, 188, 38); background-color: rgba(0, 0, 0, 0.901961);"><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"> <span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(205, 121, 35);">associatedtype</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"><span class="Apple-converted-space"> </span>Iterator</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">:</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"><span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures;">IteratorProtocol</span></div><div class="" style="margin: 0px; line-height: normal; font-family: 'Andale Mono'; color: rgb(130, 185, 255); background-color: rgba(0, 0, 0, 0.901961);"><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"> <span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">func</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"><span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);">map</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);"><</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);">T</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);">(</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);">...</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);">)<span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">-></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"><span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">[</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 188, 38);">T</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">]</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"><span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures;">// Iterable where .Iterator.Element == T</span></div><div class="" style="margin: 0px; line-height: normal; font-family: 'Andale Mono'; color: rgb(130, 185, 255); background-color: rgba(0, 0, 0, 0.901961);"><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"> <span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">func</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"><span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);">filter</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);">(</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);">...</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);">)<span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">-></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"><span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">[</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 188, 38);">Iterator.Element</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">]</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"><span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures;">// Iterable where .Iterator.Element == Self.Iterator.Element</span></div><div class="" style="margin: 0px; line-height: normal; font-family: 'Andale Mono'; color: rgb(52, 187, 200); background-color: rgba(0, 0, 0, 0.901961);"><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"> <span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">func</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"><span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures;">forEach</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);">(</span><span class="" style="font-variant-ligatures: no-common-ligatures;">...</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);">)</span></div><div class="" style="margin: 0px; line-height: normal; font-family: 'Andale Mono'; color: rgb(52, 187, 200); background-color: rgba(0, 0, 0, 0.901961);"><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"> <span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">func</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"><span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures;">makeIterator</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);">()<span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">-></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"><span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 188, 38);">Iterator</span></div><div class="" style="margin: 0px; line-height: normal; font-family: 'Andale Mono'; color: rgb(52, 187, 200); background-color: rgba(0, 0, 0, 0.901961);"><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"> <span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">var</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"><span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures;">underestimatedCount</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">:</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"><span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 188, 38);">Int</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"><span class="Apple-converted-space"> </span>{<span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(205, 121, 35);">get</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"><span class="Apple-converted-space"> </span>}</span></div><div class="" style="margin: 0px; line-height: normal; font-family: 'Andale Mono'; color: rgb(214, 214, 214); background-color: rgba(0, 0, 0, 0.901961);"><span class="" style="font-variant-ligatures: no-common-ligatures;">}</span></div><div class="" 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;"><span class="" style="font-variant-ligatures: no-common-ligatures;"></span><br class=""></div><div class="" style="margin: 0px; line-height: normal; font-family: 'Andale Mono'; color: rgb(130, 185, 255); background-color: rgba(0, 0, 0, 0.901961);"><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">public</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"><span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">protocol</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"><span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);">Sequence</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">:</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"><span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 188, 38);">Iterable</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"><span class="Apple-converted-space"> </span>{<span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures;">// Maybe OrderedSequence just to make the well-defined-order requirement explicit</span></div><div class="" style="margin: 0px; line-height: normal; font-family: 'Andale Mono'; color: rgb(214, 214, 214); background-color: rgba(0, 0, 0, 0.901961);"><span class="" style="font-variant-ligatures: no-common-ligatures;"> <span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(205, 121, 35);">associatedtype</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span>SubSequence</span></div><div class="" style="margin: 0px; line-height: normal; font-family: 'Andale Mono'; color: rgb(130, 185, 255); background-color: rgba(0, 0, 0, 0.901961);"><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"> <span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">func</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"><span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);">dropFirst</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);">(</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);">...</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);">) <span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">-></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"><span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 188, 38);">SubSequence</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"><span class="Apple-converted-space"> </span> <span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures;">// Sequence where .Iterator.Element == Self.Iterator.Element</span></div><div class="" style="margin: 0px; line-height: normal; font-family: 'Andale Mono'; color: rgb(214, 214, 214); background-color: rgba(0, 0, 0, 0.901961);"><span class="" style="font-variant-ligatures: no-common-ligatures;"> <span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">func</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);">dropLast</span><span class="" style="font-variant-ligatures: no-common-ligatures;">(</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);">...</span><span class="" style="font-variant-ligatures: no-common-ligatures;">) <span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">-></span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 188, 38);">SubSequence</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span> <span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(130, 185, 255);">// " "</span></div><div class="" style="margin: 0px; line-height: normal; font-family: 'Andale Mono'; color: rgb(214, 214, 214); background-color: rgba(0, 0, 0, 0.901961);"><span class="" style="font-variant-ligatures: no-common-ligatures;"> <span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">func</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);">drop</span><span class="" style="font-variant-ligatures: no-common-ligatures;">(</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(205, 121, 35);">while</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);">...</span><span class="" style="font-variant-ligatures: no-common-ligatures;">) <span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">-></span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 188, 38);">SubSequence</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span> <span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(130, 185, 255);">// " "</span></div><div class="" style="margin: 0px; line-height: normal; font-family: 'Andale Mono'; color: rgb(214, 214, 214); background-color: rgba(0, 0, 0, 0.901961);"><span class="" style="font-variant-ligatures: no-common-ligatures;"> <span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">func</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);">prefix</span><span class="" style="font-variant-ligatures: no-common-ligatures;">(</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);">...</span><span class="" style="font-variant-ligatures: no-common-ligatures;">) <span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">-></span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 188, 38);">SubSequence</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span> <span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(130, 185, 255);">// " "</span></div><div class="" style="margin: 0px; line-height: normal; font-family: 'Andale Mono'; color: rgb(52, 188, 38); background-color: rgba(0, 0, 0, 0.901961);"><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"> <span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">func</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"><span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);">prefix</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);">(</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(205, 121, 35);">while</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);">...</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);">)<span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">-></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"><span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures;">SubSequence</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"><span class="Apple-converted-space"> </span> <span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(130, 185, 255);">// " "</span></div><div class="" style="margin: 0px; line-height: normal; font-family: 'Andale Mono'; color: rgb(214, 214, 214); background-color: rgba(0, 0, 0, 0.901961);"><span class="" style="font-variant-ligatures: no-common-ligatures;"> <span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">func</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);">suffix</span><span class="" style="font-variant-ligatures: no-common-ligatures;">(</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);">...</span><span class="" style="font-variant-ligatures: no-common-ligatures;">) <span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">-></span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 188, 38);">SubSequence</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span> <span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(130, 185, 255);">// " "</span></div><div class="" style="margin: 0px; line-height: normal; font-family: 'Andale Mono'; color: rgb(130, 185, 255); background-color: rgba(0, 0, 0, 0.901961);"><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"> <span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">func</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"><span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);">split</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);">(</span><span class="" style="color: rgb(52, 187, 200);">...</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(205, 121, 35);">where</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 187, 200);">...</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);">) <span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">-></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"><span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">[</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(52, 188, 38);">SubSequence</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(233, 175, 205);">]</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(214, 214, 214);"><span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures;">// Iterable where .Iterator.Element == (Sequence where .Iterator.Element == Self.Iterator.Element)</span></div><div class="" style="margin: 0px; line-height: normal; font-family: 'Andale Mono'; color: rgb(214, 214, 214); background-color: rgba(0, 0, 0, 0.901961);"><span class="" style="font-variant-ligatures: no-common-ligatures;">}</span></div><div class=""><span class="" style="font-variant-ligatures: no-common-ligatures;"><br class=""></span></div><div class=""><span class="" style="font-variant-ligatures: no-common-ligatures;">(The comments, of course, would be more sensible types once the ideas can actually be expressed in 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 well-defined behavior; no change would be needed for ordered collections.<br class=""><br class="">Now, the practical matter. If this were Swift 1->2 or 2->3, I doubt there would be a significant issue with actually making this change. Unfortunately, we're well beyond that and making a change this deep is an 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 breakage is justified and a net benefit.<br class=""><br class="">2. We could try and think of a way to make the distinction between ordered and unordered "sequences" in a less-breaking manner. Unfortunately, I don't have a good suggestion for this, but if anyone has ideas, I'm all ears. Or eyes, as the case may be.<br class=""><br class=""></span></div><br class=""></div><div class=""><div class=""><blockquote type="cite" class=""><div class="">On Oct 12, 2017, at 4:24 PM, Xiaodi Wu via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><h1 class="">Rename<span class="Apple-converted-space"> </span><code class="">Sequence.elementsEqual</code></h1><ul class=""><li class="">Proposal:<span class="Apple-converted-space"> </span><a href="https://gist.github.com/xwu/NNNN-rename-elements-equal.md" class="">SE-NNNN</a></li><li class="">Authors:<span class="Apple-converted-space"> </span><a href="https://github.com/xwu" class="">Xiaodi Wu</a></li><li class="">Review Manager: TBD</li><li class="">Status:<span class="Apple-converted-space"> </span><strong class="">Awaiting review</strong></li></ul><h2 class=""><a href="https://gist.github.com/xwu/1f0ef4e18a7f321f22ca65a2f56772f6#introduction" class="gmail-anchor" id="gmail-user-content-introduction"></a>Introduction</h2><p class="">The current behavior of<span class="Apple-converted-space"> </span><code class="">Sequence.elementsEqual</code><span class="Apple-converted-space"> </span>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<span class="Apple-converted-space"> </span><code class="">Sequence.lexicographicallyEquals</code>.</p><div class="">[...]</div></div></div></blockquote></div></div></div></div>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></div></blockquote></div></blockquote></div><br class="" 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; -webkit-text-stroke-width: 0px;"><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; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">_______________________________________________</span><br 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; -webkit-text-stroke-width: 0px;" class=""><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; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">swift-evolution mailing list</span><br 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; -webkit-text-stroke-width: 0px;" class=""><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; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a></span><br 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; -webkit-text-stroke-width: 0px;" class=""><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; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span></div></blockquote></div><br class=""></div></div></div></div></blockquote><blockquote type="cite" class=""><div class=""><span class="">_______________________________________________</span><br class=""><span class="">swift-evolution mailing list</span><br class=""><span class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a></span><br class=""><span class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br class=""></div></blockquote></div></div></div>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></body></html>