<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 <<a href="mailto:clattner@apple.com" class="">clattner@apple.com</a>> 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 <<a href="mailto:erica@ericasadun.com" class="">erica@ericasadun.com</a>> wrote:<br class=""><br class=""><br class=""><blockquote type="cite" class="">On Jun 7, 2016, at 9:37 PM, Chris Lattner <<a href="mailto:clattner@apple.com" class="">clattner@apple.com</a>> wrote:<br class=""><br class=""><br class=""><blockquote type="cite" class="">On Jun 6, 2016, at 8:35 AM, Erica Sadun via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> 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? 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="">> </div><div class="">> on Fri May 06 2016, Kevin Ballard <swift-evolution <at> <a href="http://swift.org" class="">swift.org</a>> wrote:</div><div class="">> </div><div class="">> > On Fri, May 6, 2016, at 05:31 PM, Kevin Ballard wrote:</div><div class="">> >> On Fri, May 6, 2016, at 05:19 PM, Dave Abrahams via swift-evolution wrote:</div><div class="">> >> > </div><div class="">> >> > on Wed May 04 2016, Chris Lattner <swift-evolution <at> <a href="http://swift.org" class="">swift.org</a>> wrote:</div><div class="">> >> > </div><div class="">> >> > > 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="">> ></div><div class="">> >> > ></div><div class="">> >> > > Hello Swift Community,</div><div class="">> >> > ></div><div class="">> >> > > The review of SE-0045: "Add scan, prefix(while:), drop(while:), and</div><div class="">> >> > > unfold to the stdlib" ran from April 28...May 3, 2016. A subset of the</div><div class="">> >> > > proposal is *accepted, with modifications* for Swift 3. This proposal</div><div class="">> >> > > included four new additions to the standard library:</div><div class="">> >> > ></div><div class="">> >> > > Sequence.prefix(while:) & Sequence.drop(while:) - These are *accepted* as specified in revision</div><div class="">3 of the proposal.</div><div class="">> >> > </div><div class="">> >> > I know the review is over and all, but…</div><div class="">> >> > </div><div class="">> >> > Chris brought to my attention an idea that I liked, and asked me to post</div><div class="">> >> > here about it. Specifically, the argument label “where:” would probably</div><div class="">> >> > be better than “while:”. “While” makes it sound to me like it's going</div><div class="">> >> > to take a nullary predicate and be much more active. But it's hard to</div><div class="">> >> > love</div><div class="">> >> > </div><div class="">> >> > s.drop(where: { $0 > 1 })</div><div class="">> >> > s.drop { $0 > 1 }</div><div class="">> >> > </div><div class="">> >> > because it makes it sound like a general filtering operation.</div><div class="">> >> > </div><div class="">> >> > Therefore, I'd much rather see</div><div class="">> >> > </div><div class="">> >> > s.droppingPrefix(where: {$0 > 1})</div><div class="">> >> </div><div class="">> >> Using "where:" has a very high potential for confusion, because</div><div class="">> >> "where" makes it sound like it runs the predicate against every</div><div class="">> >> single element, whereas "while" makes it clear that it stops</div><div class="">> >> evaluating elements once the predicate returns false. Or in other</div><div class="">> >> words, `drop(where: predicate)` looks like it should be equivalent</div><div class="">> >> to `filter({ !predicate($0) })`.</div><div class="">> ></div><div class="">> > Oops, I read your message too fast and missed the fact that you</div><div class="">> > changed the function name too in the very last line.</div><div class="">> </div><div class="">> 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="">> > If we switched to `droppingPrefix(where:)` then we'd need to change `dropFirst(_:)` as well.</div><div class="">> </div><div class="">> Yes, as I noted in my response to Erica, I would like to see some more design</div><div class="">> coherence in this whole area. I think</div><div class="">> </div><div class="">> xs.dropFirst() => xs.droppingFirst()</div><div class="">> xs.dropFirst(3) => xs.droppingPrefix(ofMaxLength: 3)</div><div class="">> </div><div class="">> I'm not wedded to “dropping,” especially because it has other</div><div class="">> connotations. Dmitri, Max, and I kicked around a bunch of other</div><div class="">> possibilities, e.g.</div><div class="">> </div><div class="">> sansPrefix</div><div class="">> 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="">> Anyway, we can't do all of that by the seat of our pants. I personally</div><div class="">> wouldn't want to go any further than s.dropPrefix(where: ...) without a</div><div class="">> 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>