<!DOCTYPE html>
<html>
<head>
<title></title>
<style type="text/css">p.MsoNormal,p.MsoNoSpacing{margin:0}</style>
</head>
<body><div>On Wed, Nov 15, 2017, at 12:55 PM, John McCall via swift-evolution wrote:<br></div>
<blockquote type="cite"><div>Hello, Swift Community!<br></div>
<div><br></div>
<div>The initial review of "SE-0187: Introduce Sequence.filterMap(_:)" ran through yesterday, November 14th, 2017. The proposal is available here:<br></div>
<div><br></div>
<blockquote style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:40px;border-top-width:initial;border-right-width:initial;border-bottom-width:initial;border-left-width:initial;border-top-style:none;border-right-style:none;border-bottom-style:none;border-left-style:none;border-top-color:initial;border-right-color:initial;border-bottom-color:initial;border-left-color:initial;border-image-source:initial;border-image-slice:initial;border-image-width:initial;border-image-outset:initial;border-image-repeat:initial;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;"><div><a href="https://github.com/apple/swift-evolution/blob/master/proposals/0187-introduce-filtermap.md">https://github.com/apple/swift-evolution/blob/master/proposals/0187-introduce-filtermap.md</a><br></div>
</blockquote><div><br></div>
<div>There was a significant amount of discussion, and people came down with reasonable arguments both for and against the proposal. After reviewing that feedback, the core team feels that the central question is whether Swift benefits from overloading flatMap in this way. There is a reasonable argument that an Optional is a sort of container, and therefore it makes sense to "flatten" that container into a surrounding container. But Swift has resisted applying that interpretation in its library design; for example, you cannot directly iterate an Optional or append its contents to an Array. In general, we feel that using different operations for working with Optionals tends to make code easier to both write and understand, especially given the existence of implicit optional promotion, which we cannot eliminate or easily suppress based on the context. On reflection, we think it was a mistake to use the same name in the first place, and there is no better time to fix a mistake than now.<br></div>
<div><br></div>
<div>While we accept that this will cause some amount of "code churn" for developers when they adopt Swift 5, the required change is a simple rename that should be painless to automatically migrate. Of course, sample code on the internet will become obsolete, but fix-its will easily update that code if pasted into a project, and the samples themselves (once corrected) should become clearer and easier to teach after this change, as is generally true when overloading is removed.<br></div>
<div><br></div>
<div>Accordingly, SE-0187 is <b>accepted</b>, at least as far as not calling the operation "flatMap". We are re-opening the review until next Monday, November 20th, 2017, in order to have a focused discussion about the new name. Names that seemed to gain some traction in the first review include:<br></div>
<div><br></div>
<div> - filterMap, which has precedent in existing functional languages, as well as some popular Swift libraries, but which some people view as confusing<br></div>
<div><br></div>
<div> - compactMap, which builds off the precedent of "compact" in Ruby<br></div>
<div><br></div>
<div>But please feel free to suggest a name other than these.<br></div>
<div><br></div>
<div><b>Reviews</b><br></div>
<div><br></div>
<div><div>Reviews are an important part of the Swift evolution process. All reviews should be sent to the swift-evolution mailing list at<br></div>
<div><br></div>
<blockquote style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:40px;border-top-width:initial;border-right-width:initial;border-bottom-width:initial;border-left-width:initial;border-top-style:none;border-right-style:none;border-bottom-style:none;border-left-style:none;border-top-color:initial;border-right-color:initial;border-bottom-color:initial;border-left-color:initial;border-image-source:initial;border-image-slice:initial;border-image-width:initial;border-image-outset:initial;border-image-repeat:initial;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;"><a href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br></blockquote><div><br></div>
<div>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></div>
<div><br></div>
<blockquote style="margin-top:0px;margin-right:0px;margin-bottom:16px;margin-left:0px;padding-top:0px;padding-right:1em;padding-bottom:0px;padding-left:1em;border-left-width:0.25em;border-left-style:solid;border-left-color:rgb(223, 226, 229);background-color:rgb(255, 255, 255);"><p style="margin-top: 0px; margin-bottom: 16px;"><span class="colour" style="color:rgb(106, 115, 125)"><span class="font" style="font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol""><span class="size" style="font-size:16px">Proposal link:</span></span></span><br></p><blockquote style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;padding-top:0px;padding-right:1em;padding-bottom:0px;padding-left:1em;border-left-width:0.25em;border-left-style:solid;border-left-color:rgb(223, 226, 229);"><span class="size" style="font-size:medium"><a href="https://github.com/apple/swift-evolution/blob/master/proposals/0187-introduce-filtermap.md">https://github.com/apple/swift-evolution/blob/master/proposals/0187-introduce-filtermap.md</a></span><br></blockquote></blockquote><blockquote style="margin-top:0px;margin-right:0px;margin-bottom:16px;margin-left:0px;padding-top:0px;padding-right:1em;padding-bottom:0px;padding-left: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 style="margin-top:0px;margin-bottom:0px;">Reply text<br></div>
</blockquote><blockquote style="margin-top:0px;margin-right:0px;margin-bottom:16px;margin-left:0px;padding-top:0px;padding-right:1em;padding-bottom:0px;padding-left: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 style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;padding-top:0px;padding-right:1em;padding-bottom:0px;padding-left:1em;border-left-width:0.25em;border-left-style:solid;border-left-color:rgb(223, 226, 229);"><div style="margin-top:0px;margin-bottom:0px;">Other replies<br></div>
</blockquote></blockquote><div><b>What goes into a review?</b><br></div>
<div><br></div>
<div>The goal of the review process is to improve the proposal under review through constructive criticism and, eventually, determine the direction of Swift.<br></div>
<div><br></div>
<div><div>When writing your review, here are some questions you might want to answer in your review:<br></div>
<div><br></div>
<div>• What is your evaluation of the proposal?<br></div>
</div>
</div>
</blockquote><div><br></div>
<div>I'm not happy about the method being renamed, but if it must, I'm in favor of filterMap. All the other suggestions I've seen are either weird (e.g. "compact", which has no precedent in Swift or anything else I can think of beyond Ruby), or potentially misleading (like mapSome, which sounds like it takes a sequence of optionals and only modifies the non-nil values).<br></div>
<div><br></div>
<div>-Kevin Ballard</div>
<div><br></div>
<blockquote type="cite"><div><div><div><span style="white-space:pre;"></span>• Is the problem being addressed significant enough to warrant a change to Swift?<br></div>
<div><span style="white-space:pre;"></span>• Does this proposal fit well with the feel and direction of Swift?<br></div>
<div><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></div>
<div><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></div>
<div><br></div>
<div>More information about the Swift evolution process is available at:<br></div>
<div><br></div>
<blockquote style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:40px;border-top-width:initial;border-right-width:initial;border-bottom-width:initial;border-left-width:initial;border-top-style:none;border-right-style:none;border-bottom-style:none;border-left-style:none;border-top-color:initial;border-right-color:initial;border-bottom-color:initial;border-left-color:initial;border-image-source:initial;border-image-slice:initial;border-image-width:initial;border-image-outset:initial;border-image-repeat:initial;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;"><div><a href="https://github.com/apple/swift-evolution/blob/master/process.md">https://github.com/apple/swift-evolution/blob/master/process.md</a><br></div>
</blockquote><div><div><br></div>
<div>As always, thank you for contributing to the evolution of Swift.<br></div>
<div><br></div>
<div>John McCall<br></div>
<div>Review Manager<br></div>
</div>
</div>
</div>
<div><u>_______________________________________________</u><br></div>
<div>swift-evolution mailing list<br></div>
<div><a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br></div>
<div><a href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br></div>
</blockquote><div><br></div>
</body>
</html>