<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=""><div class=""><i class="">• What is your evaluation of the proposal?</i></div><div class="">I approve. This variant of ‘Sequence.flatMap’ is confusing to newcomers, and is inconsistent with the standard term-of-art usage of “flatMap”. People can learn what it means, but it continues to feel awkward. There will be some code churn, but it’s easily automatable and improves the clarity of the code. If we leave the existing spelling in place as deprecated, then we even preserve source compatibility.</div><div class=""><div class=""><br class=""></div><div class=""><i class="">• Is the problem being addressed significant enough to warrant a change to Swift?</i><br class=""></div><div class="">I think so. The existing spelling of this functionality has three problems:</div></div><ol class=""><li class="">Discoverability: Users looking to filter out ‘nil’ values have to know to look for something that doesn’t say “filter”</li><li class="">Unexpected behavior: Users who are unfamiliar with the concept of Optionals as a Sequence-of-one have difficulty understanding why this is called “flatMap”. They don’t know what it does. I’ve seen this many times.</li><li class="">Brittleness: The functionality changes dramatically if the body of the function changes from returning an Optional to a Sequence. An example of this was given in the proposal, but here’s another one: </li></ol><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class=""><div class=""><font face="Courier" class="">struct Thing {</font></div></div><div class=""><div class=""><font face="Courier" class=""> var name: String? // What if this becomes non-optional in the future?</font></div></div><div class=""><div class=""><font face="Courier" class="">}</font></div></div><div class=""><div class=""><span style="font-family: Courier;" class=""><br class=""></span></div></div><div class=""><div class=""><span style="font-family: Courier;" class="">// If Thing.name is optional, this returns an array of names (with nil filtered out)</span></div></div><div class=""><div class=""><font face="Courier" class="">// If Thing.name becomes non-optional, this now returns an array of all the characters in all the names, concatenated</font></div></div><div class=""><div class=""><font face="Courier" class="">things.flatMap { $0.name }</font></div></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class="">In general, changing from optional to non-optional causes compiler warnings in cases where something wasn’t expecting that. This isn’t likely a <i class="">common</i> problem, but it isn’t a great argument in defense of the current situation.</div></blockquote><div class=""><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><i class="">• Does this proposal fit well with the feel and direction of Swift?</i><br class=""></div><div class="">Yes. Clear names are a common theme in Swift, and we have other proposals in Swift 5 with a similar goal.</div><div class=""><br class=""></div><div class=""><i class="">• If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?</i><br class=""></div><div class="">It makes us behavior more like those other languages, reducing user surprise.</div><div class=""><br class=""></div><div class=""><i class="">• How much effort did you put into your review? A glance, a quick reading, or an in-depth study?</i></div></div><div class="">I was in the process of writing up a similar proposal myself when this one came out. I’ve thought about this quite a bit, and I think it’s the right choice.</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">-BJ<br class=""></div><div class=""><br class=""></div><div><br class=""><blockquote type="cite" class=""><div class="">On Nov 7, 2017, at 4:23 PM, John McCall 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 style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hello, Swift community!<div class=""><br class=""></div><div class="">The review of "SE-0187: Introduce Sequence.filterMap(_:)" begins now and runs through November 14th, 2017. The proposal is available here:</div><div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class=""><a href="https://github.com/apple/swift-evolution/blob/master/proposals/0187-introduce-filtermap.md" class="">https://github.com/apple/swift-evolution/blob/master/proposals/0187-introduce-filtermap.md</a></div></blockquote><div class=""><br class=""></div><div class="">Reviews are an important part of the Swift evolution process. All reviews should be sent to the swift-evolution mailing list at</div><div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></blockquote><br class="">or, if you would like to keep your feedback private, directly to me as the review manager. When replying, please try to keep the proposal link at the top of the message:<br class=""><br class=""><blockquote class="" style="box-sizing: border-box; margin: 0px 0px 16px; padding: 0px 1em; border-left-width: 0.25em; border-left-style: solid; border-left-color: rgb(223, 226, 229); background-color: rgb(255, 255, 255);"><p class="" style="color: rgb(106, 115, 125); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; box-sizing: border-box; margin-top: 0px; margin-bottom: 16px;">Proposal link:</p><blockquote class="" style="box-sizing: border-box; margin: 0px; padding: 0px 1em; border-left-width: 0.25em; border-left-style: solid; border-left-color: rgb(223, 226, 229);"><font size="3" class=""><a href="https://github.com/apple/swift-evolution/blob/master/proposals/0187-introduce-filtermap.md" class="">https://github.com/apple/swift-evolution/blob/master/proposals/0187-introduce-filtermap.md</a></font></blockquote></blockquote><blockquote class="" style="box-sizing: border-box; margin: 0px 0px 16px; padding: 0px 1em; color: rgb(106, 115, 125); border-left-width: 0.25em; border-left-style: solid; border-left-color: rgb(223, 226, 229); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);"><div class="" style="box-sizing: border-box; margin-top: 0px; margin-bottom: 0px;">Reply text</div></blockquote><blockquote class="" style="box-sizing: border-box; margin: 0px 0px 16px; padding: 0px 1em; color: rgb(106, 115, 125); border-left-width: 0.25em; border-left-style: solid; border-left-color: rgb(223, 226, 229); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);"><blockquote class="" style="box-sizing: border-box; margin: 0px; padding: 0px 1em; border-left-width: 0.25em; border-left-style: solid; border-left-color: rgb(223, 226, 229);"><div class="" style="box-sizing: border-box; margin-top: 0px; margin-bottom: 0px;">Other replies</div></blockquote></blockquote><b class="">What goes into a review?</b><br class=""><br class="">The goal of the review process is to improve the proposal under review through constructive criticism and, eventually, determine the direction of Swift.<div class=""><br class=""></div><div class="">When writing your review, here are some questions you might want to answer in your review:<br class=""><br class=""><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>• What is your evaluation of the proposal?<br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>• Is the problem being addressed significant enough to warrant a change to Swift?<br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>• Does this proposal fit well with the feel and direction of Swift?<br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>• If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?<br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>• How much effort did you put into your review? A glance, a quick reading, or an in-depth study?<br class=""></div><div class=""><br class=""></div>More information about the Swift evolution process is available at:<div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class=""><a href="https://github.com/apple/swift-evolution/blob/master/process.md" class="">https://github.com/apple/swift-evolution/blob/master/process.md</a></div></blockquote><div class=""><br class="">As always, thank you for contributing to the evolution of Swift.<br class=""><br class="">John McCall<br class="">Review Manager<br class=""></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>