<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=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Nov 7, 2017, at 5:23 PM, Tino Heth via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; 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; line-break: after-white-space;" class="">-1<div class=""><br class=""></div><div class="">I guess breaking existing code will be the show stopper for this proposal — but I generally think that compatibility is a poor rationale to stop an improvement, so my personal reasons are different:</div><div class="">The name is just wrong.</div><div class="">Just have a look at this simple example</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(186, 45, 162); background-color: rgb(255, 255, 255);" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal;" class="">extension<span style="" class="">&nbsp;</span><span style="color: rgb(112, 61, 170);" class="">Int</span><span style="" class="">&nbsp;{</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class="">&nbsp; &nbsp;&nbsp;<span style="color: rgb(186, 45, 162);" class="">func</span>&nbsp;justImagineError()&nbsp;<span style="color: rgb(186, 45, 162);" class="">throws</span>&nbsp;-&gt;&nbsp;<span style="color: rgb(112, 61, 170);" class="">Int</span>&nbsp;{</div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="" class="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span>return<span style="" class="">&nbsp;</span>self</div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class="">&nbsp; &nbsp;&nbsp;}</div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class="">}</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Helvetica; min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="color: rgb(186, 45, 162);" class="">let</span>&nbsp;ints: [<span style="color: rgb(112, 61, 170);" class="">Int</span>?] = [<span style="color: rgb(186, 45, 162);" class="">nil</span>]</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Helvetica; min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="color: rgb(186, 45, 162);" class="">let</span>&nbsp;result =&nbsp;<span style="color: rgb(79, 129, 135);" class="">ints</span>.<span style="color: rgb(62, 30, 129);" class="">flatMap</span>&nbsp;{</div><div style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(49, 89, 93);" class=""><span style="" class="">&nbsp; &nbsp;&nbsp;</span><span style="color: rgb(186, 45, 162);" class="">return</span><span style="" class="">&nbsp;</span><span style="color: rgb(186, 45, 162);" class="">try</span><span style="" class="">? $0?.</span>justImagineError<span style="" class="">()</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class="">}</div><div style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(79, 129, 135);" class=""><span style="color: rgb(62, 30, 129);" class="">print</span><span style="" class="">(</span>result<span style="" class="">)</span></div><div class=""><span style="" class=""><br class=""></span></div></div></div></div><div class="">If flatMap would really filter out nil values, this should yield an empty array as result — but the actual output is&nbsp;<b style="font-family: Menlo;" class="">[nil]</b></div></div></div></blockquote><div><br class=""></div><div>This is a wonderful example! But it’s an argument for a different discussion (of general usefulness of implicit optional promotion). Thanks to the optional promotion, what the closure returns is not nil, but instead is .some(nil), and that is not filtered out.</div><div><br class=""></div><br class=""><blockquote type="cite" class=""><div class="">_______________________________________________<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>