<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="">On Nov 9, 2017, at 9:13 AM, Tino Heth via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:<br class=""><div><blockquote type="cite" class=""><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html; charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class=""><br class=""><blockquote type="cite" class=""><div class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Experienced programmers (as experienced as any Swift programmer can be for a 4-year-old language) frequently use flatMap when they mean map</span></div></blockquote></div>When you look at those examples:<div class="">What would stop those programmers to use filterMap in the exact same way, instead of switching to map?</div><div class="">A hypothetic migrator most likely would just replace names…</div></div></div></blockquote><div><br class=""></div><div><br class=""></div><div>The migrator would already have to be aware of the return type of the closure (to avoid migrating cases where it’s actually returning a sequence as expected), so the migrator could easily only migrate the ones that are actually returning optionals in the first place.</div><div><br class=""></div><div>Programmers could continue to use filterMap incorrectly, but it would be a more explicit choice. Currently, there’s a sense among some Swift users (including some that I know personally) that flatMap is the “smart” thing to use with collections because monads or something, without any real understanding of why that is. (Remember, Swift doesn’t even have a “flatten()” function anymore, so the name “flatMap" is far from obvious.) I think it’s less likely that people will continue to use “filterMap” when they know no filtering is happening.</div><div><br class=""></div><div>-BJ</div></div></body></html>