<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">        <a href="https://github.com/apple/swift-evolution/blob/master/proposals/0132-sequence-end-ops.md" rel="noreferrer" target="_blank">https://github.com/apple/swift-evolution/blob/master/proposals/0132-sequence-end-ops.md</a><br><br>
        * What is your evaluation of the proposal?<br></blockquote><div><br></div><div>+1 on drop{First,Last}() → removing{First,Last}().</div>+1 on drop{First,Last}(_:) → removing{Prefix,Suffix}(_:).<div>+1 on drop(while:) → removingPrefix(while:).</div><div>+1 on starts(with:[by:]) → hasPrefix(_:[by:]).</div><div>+1 on index({of:,where:}) → firstIndex({of:,where:}).</div><div>+1 on prefix and postfix versions of ..&lt; and the prefix version of the ... operator. For a while I thought I might prefer labeled subscripts, but after writing them out I agree the operators are better.</div><div><br></div><div>The rest is a stream of consciousness:.</div><div><br></div><div>I don&#39;t think postfix ... is necessary. When does one ever combine a ClosedRange with endIndex?</div><div><br></div><div>I don&#39;t agree that &quot;drop&quot; sounds particularly scary, but I&#39;m fine with &quot;removing&quot; as an alternative to &quot;drop&quot;/&quot;dropping&quot;. Scatologists will be disappointed, I&#39;m sure.</div><div><br></div><div>I&#39;d forgotten about prefix(while:), which apparently isn&#39;t implemented yet. I think I&#39;d prefer if this were named prefix(where:) instead.</div><div><br></div><div>I&#39;m struggling a little with the distinction between length-based and index-based methods/subscripts. Are &quot;prefix(_ length: Int)&quot; and &quot;prefix(upTo end: Index)&quot; really different enough that one of them should be a subscript and the other a method? The same question applies to prefix(through:) and suffix(from:). I kinda wish these could all be methods or all subscripts.</div><div><br></div><div>I have to say I don&#39;t fully understand the need for (or benefits of) RangeExpression and the relative(to:) API (perhaps because I don&#39;t have much experience using the most recent collection/index/range APIs). Since the conforming type&#39;s Bound is already required to be the collection&#39;s Index, it seems pointless to have an API to access this as a Range...there should just be Collection subscript methods which accept the conforming types. I suppose it&#39;s nice to get all these for free by implementing just one subscript function (excepting the current lack of generic subscripts)...but is it even possible to express every RangeExpression as a Range? What about a ClosedRange&lt;Int&gt; whose upperBound is Int.max? (Wasn&#39;t that the whole point of introducing ClosedRange in the first place?)</div><div><br></div><div>Random question: why do we have both removeFirst and popFirst?  ...on further reading I see you covered this in Future Directions. I&#39;d be happy to discuss merging these. I wonder if it&#39;s important to do for Swift 3 (although we&#39;re basically out of time)?</div><div><br></div><div>The name IncompleteRange makes sense, but could be a little misleading if ..&lt;(Bound?,Bound?) is called with two non-nil operands: based on my reading, it sounds like the returned IncompleteRange wouldn&#39;t actually change when you call completed(by:) (since it&#39;s not actually incomplete). However, I can&#39;t come up with any better naming suggestions.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
        * Is the problem being addressed significant enough to warrant a change to Swift?<br></blockquote><div><br></div><div>Yes.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
        * Does this proposal fit well with the feel and direction of Swift?<br></blockquote><div><br></div><div>Mostly. Not sure there&#39;s enough consistency between subsequence-length-based and index-based APIs, namely that prefix(upTo:) becomes a subscript but prefix(_:) doesn&#39;t.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
        * If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?<br></blockquote><div><br></div><div>I&#39;ve used Python and Mathematica, which both have functionality similar to &quot;incomplete range subscripts&quot;:</div><div><br class="">    Python: <a href="http://stackoverflow.com/a/509295/23649">http://stackoverflow.com/a/509295/23649</a><br></div><div>    Mathematica: <a href="https://reference.wolfram.com/language/ref/Span.html" target="_blank">https://reference.wolfram.com/language/ref/Span.html</a></div><div><br></div><div>Based on my experience there, this is a good first (second?) step for Swift to take.</div><div><br></div><div>Both Mathematica and Python support a <b>stride</b> as well as start/end indices in their subscripting syntax. It would be nice for Swift to support something like this, but some versions of that would require custom ternary operators (or weird intermediate types to fake a custom ternary operator). We might also consider labelled multi-argument subscripts like &quot;collection[start..&lt;end, by: 2]&quot;.</div><div><br></div><div>They also both support <b>negative indices </b>which count from the end. Swift&#39;s suffix-based APIs are limited; I&#39;d like to see an in-depth consideration of this down the line. Now is probably not the time, unless anyone can think of reasons it would affect the syntax/naming we choose in this proposal.</div><div><br></div><div>(It&#39;s also interesting to note that Mathematica&#39;s subscripts (<a href="https://reference.wolfram.com/language/ref/Part.html">Part</a>) support multi-dimensional arrays:  matrix[[3;;4, -5;;]] would be the submatrix containing the last 5 entries in rows 3 and 4 of the original matrix.)</div></div></div><div class="gmail_extra"><div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
        * How much effort did you put into your review? A glance, a quick reading, or an in-depth study?<br></blockquote><div><br></div><div>A mostly-thorough reading of the proposal.</div></div></div></div>