<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=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jun 8, 2016, at 12:05 AM, Chris Lattner &lt;<a href="mailto:clattner@apple.com" class="">clattner@apple.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><blockquote type="cite" style="font-family: Palatino-Roman; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class="Apple-interchange-newline">On Jun 7, 2016, at 9:54 PM, Erica Sadun &lt;<a href="mailto:erica@ericasadun.com" class="">erica@ericasadun.com</a>&gt; wrote:<br class=""><br class=""><br class=""><blockquote type="cite" class="">On Jun 7, 2016, at 9:37 PM, Chris Lattner &lt;<a href="mailto:clattner@apple.com" class="">clattner@apple.com</a>&gt; wrote:<br class=""><br class=""><br class=""><blockquote type="cite" class="">On Jun 6, 2016, at 8:35 AM, Erica Sadun via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:<br class=""><br class="">Did we ever get to a stopping point on SE-0045, with the take while / drop while methods? I remember we were discussing using prefix / suffix and a bunch of other names, but was the consensus ever fully settled? I'm going back through the gmane archive, the SE repo, and the 5-31 dev build and can't seem to find anything on either one. I'm hoping I'm just missing something but fearing it never got settled. If not, I'd be happy to jump in and do the paperwork, but I'd really prefer if the two methods were there and I was just somehow overlooking them.<br class=""></blockquote><br class="">My understanding is that prefix(while:) and drop(while:) were accepted, per the rationale:<br class=""><a href="http://thread.gmane.org/gmane.comp.lang.swift.evolution/16119" class="">http://thread.gmane.org/gmane.comp.lang.swift.evolution/16119</a><br class=""><br class="">-Chris<br class=""></blockquote><br class="">After that was a lively discussion about rationalizing first/last/prefix/suffix/drop/take/etc. methods was there not?<br class=""></blockquote><br style="font-family: Palatino-Roman; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Palatino-Roman; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Hah, entirely possible, who can say? &nbsp;So much email! :-) :-)</span><br style="font-family: Palatino-Roman; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Palatino-Roman; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Palatino-Roman; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">-Chris</span></div></blockquote></div><br class=""><div class="">Here's where things seem to have ended up (thank you Guillaume!)</div><div class=""><br class=""></div><div class=""><a href="http://article.gmane.org/gmane.comp.lang.swift.evolution/16334/" class="">http://article.gmane.org/gmane.comp.lang.swift.evolution/16334/</a></div><div class=""><br class=""></div><div class="">-- E</div><div class=""><br class=""></div><div class=""><div class="">On Fri, May 6, 2016, at 06:05 PM, Dave Abrahams via swift-evolution wrote:</div><div class="">&gt;&nbsp;</div><div class="">&gt; on Fri May 06 2016, Kevin Ballard &lt;swift-evolution &lt;at&gt; <a href="http://swift.org" class="">swift.org</a>&gt; wrote:</div><div class="">&gt;&nbsp;</div><div class="">&gt; &gt; On Fri, May 6, 2016, at 05:31 PM, Kevin Ballard wrote:</div><div class="">&gt; &gt;&gt; On Fri, May 6, 2016, at 05:19 PM, Dave Abrahams via swift-evolution wrote:</div><div class="">&gt; &gt;&gt; &gt;&nbsp;</div><div class="">&gt; &gt;&gt; &gt; on Wed May 04 2016, Chris Lattner &lt;swift-evolution &lt;at&gt; <a href="http://swift.org" class="">swift.org</a>&gt; wrote:</div><div class="">&gt; &gt;&gt; &gt;&nbsp;</div><div class="">&gt; &gt;&gt; &gt; &gt; Proposal link: <a href="https://github.com/apple/swift-evolution/blob/master/proposals/0045-scan-takewhile-dropwhile.md" class="">https://github.com/apple/swift-evolution/blob/master/proposals/0045-scan-takewhile-dropwhile.md</a></div><div class="">&gt; &gt;</div><div class="">&gt; &gt;&gt; &gt; &gt;</div><div class="">&gt; &gt;&gt; &gt; &gt; Hello Swift Community,</div><div class="">&gt; &gt;&gt; &gt; &gt;</div><div class="">&gt; &gt;&gt; &gt; &gt; The review of SE-0045: "Add scan, prefix(while:), drop(while:), and</div><div class="">&gt; &gt;&gt; &gt; &gt; unfold to the stdlib" ran from April 28...May 3, 2016. A subset of the</div><div class="">&gt; &gt;&gt; &gt; &gt; proposal is *accepted, with modifications* for Swift 3. &nbsp;This proposal</div><div class="">&gt; &gt;&gt; &gt; &gt; included four new additions to the standard library:</div><div class="">&gt; &gt;&gt; &gt; &gt;</div><div class="">&gt; &gt;&gt; &gt; &gt; Sequence.prefix(while:) &amp; Sequence.drop(while:) - These are *accepted* as specified in revision</div><div class="">3 of the proposal.</div><div class="">&gt; &gt;&gt; &gt;&nbsp;</div><div class="">&gt; &gt;&gt; &gt; I know the review is over and all, but…</div><div class="">&gt; &gt;&gt; &gt;&nbsp;</div><div class="">&gt; &gt;&gt; &gt; Chris brought to my attention an idea that I liked, and asked me to post</div><div class="">&gt; &gt;&gt; &gt; here about it. &nbsp;Specifically, the argument label “where:” would probably</div><div class="">&gt; &gt;&gt; &gt; be better than “while:”. &nbsp;“While” makes it sound to me like it's going</div><div class="">&gt; &gt;&gt; &gt; to take a nullary predicate and be much more active. &nbsp;But it's hard to</div><div class="">&gt; &gt;&gt; &gt; love</div><div class="">&gt; &gt;&gt; &gt;&nbsp;</div><div class="">&gt; &gt;&gt; &gt; &nbsp; &nbsp; &nbsp;s.drop(where: { $0 &gt; 1 })</div><div class="">&gt; &gt;&gt; &gt; &nbsp; &nbsp; &nbsp;s.drop { $0 &gt; 1 }</div><div class="">&gt; &gt;&gt; &gt;&nbsp;</div><div class="">&gt; &gt;&gt; &gt; because it makes it sound like a general filtering operation.</div><div class="">&gt; &gt;&gt; &gt;&nbsp;</div><div class="">&gt; &gt;&gt; &gt; Therefore, I'd much rather see</div><div class="">&gt; &gt;&gt; &gt;&nbsp;</div><div class="">&gt; &gt;&gt; &gt; &nbsp; &nbsp; &nbsp; &nbsp;s.droppingPrefix(where: {$0 &gt; 1})</div><div class="">&gt; &gt;&gt;&nbsp;</div><div class="">&gt; &gt;&gt; Using "where:" has a very high potential for confusion, because</div><div class="">&gt; &gt;&gt; "where" makes it sound like it runs the predicate against every</div><div class="">&gt; &gt;&gt; single element, whereas "while" makes it clear that it stops</div><div class="">&gt; &gt;&gt; evaluating elements once the predicate returns false. Or in other</div><div class="">&gt; &gt;&gt; words, `drop(where: predicate)` looks like it should be equivalent</div><div class="">&gt; &gt;&gt; to `filter({ !predicate($0) })`.</div><div class="">&gt; &gt;</div><div class="">&gt; &gt; Oops, I read your message too fast and missed the fact that you</div><div class="">&gt; &gt; changed the function name too in the very last line.</div><div class="">&gt;&nbsp;</div><div class="">&gt; And made the exact point that you made :-)</div><div class=""><br class=""></div><div class="">Indeed. My apologies, I was trying to get through my email too fast and ended up skimming too much.</div><div class=""><br class=""></div><div class="">&gt; &gt; If we switched to `droppingPrefix(where:)` then we'd need to change `dropFirst(_:)` as well.</div><div class="">&gt;&nbsp;</div><div class="">&gt; Yes, as I noted in my response to Erica, I would like to see some more design</div><div class="">&gt; coherence in this whole area. &nbsp;I think</div><div class="">&gt;&nbsp;</div><div class="">&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xs.dropFirst() &nbsp;=&gt; &nbsp;xs.droppingFirst()</div><div class="">&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xs.dropFirst(3) =&gt; xs.droppingPrefix(ofMaxLength: 3)</div><div class="">&gt;&nbsp;</div><div class="">&gt; I'm not wedded to “dropping,” especially because it has other</div><div class="">&gt; connotations. &nbsp;Dmitri, Max, and I kicked around a bunch of other</div><div class="">&gt; possibilities, e.g.</div><div class="">&gt;&nbsp;</div><div class="">&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sansPrefix</div><div class="">&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; withoutPrefix</div><div class=""><br class=""></div><div class="">If we do rename this, I'm partial to basing it off of the word "skip", e.g. skippingPrefix(), since that's</div><div class="">similar to "drop" but doesn't have the connotation of possibly mutating the receiver. That said, having a</div><div class="">first argument label "ofMaxLength:" seems overly verbose. Don't forget that not everybody has the</div><div class="">benefit of Xcode code completion when writing Swift code.</div><div class=""><br class=""></div><div class="">&gt; Anyway, we can't do all of that by the seat of our pants. &nbsp;I personally</div><div class="">&gt; wouldn't want to go any further than s.dropPrefix(where: ...) &nbsp;without a</div><div class="">&gt; new proposal/review.</div><div class=""><br class=""></div><div class="">Agreed, anything beyond that needs a full review. So back to the suggestion at hand.</div><div class=""><br class=""></div><div class="">I wrote up a whole long explanation for why I still think "while" is the better choice, and then I thought</div><div class="">about how this impacts `prefix(...:)` instead of `drop(...:)`, and in this context "where:" makes more</div><div class="">sense. `prefix(while:)` turns "prefix" from a noun into a verb, and the verb meaning of "prefix" is not at</div><div class="">all what we're doing with this operation. But `prefix(where:)` is still a noun and makes sense. And of</div><div class="">course if we have `prefix(where:)` then it's a bit odd to have `drop(while:)`, so we'd have to go with</div><div class="">`drop(where:)` or `dropPrefix(where:)`. So I guess I've now convinced myself while writing this email</div><div class="">that "where:" is the right choice :D</div><div class=""><br class=""></div><div class="">That said, given that we already have `dropFirst(_:)`, maybe we should go with `dropFirst(where:)`</div><div class="">instead of `dropPrefix(where:)`? Otherwise it's a bit odd to have both "dropFirst" and "dropPrefix" as</div><div class="">names. Admittedly, this same argument applies to the existing `drop(while:)` name too, and I don't have a</div><div class="">great explanation for that beyond the fact that I had a vague idea that dropFirst(_:) might be renamed to</div><div class="">drop(first:), though that can't actually happen because having both dropFirst() and drop(first:) is</div><div class="">hugely confusing, and it doesn't make sense to rename dropFirst() to drop().</div></div></body></html>