<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=""><div>-1 from me as it means that a complex statement with a single question marked variable could in fact be an entirely optional statement. While I dislike the boilerplate as well, I think it’s much better to have the explicit conditional branch there to make it absolutely clear that a statement is being executed in one case and not in another.</div><div><br class=""></div><div>I appreciate the intent of the proposal though, I just think it’s not the right solution as it could make code less readable as I feel it’s better to be explicit with cases such as these IMO.</div><div><br class=""></div><div>Also, I don’t like the nil-coalescing operator changes, as it seems to contradict the normal form where the right hand side is the fallback value, not the intended result. It’d be better to have some kind of non-nil operator, but personally I don’t think it’s worth it.</div><div><br class=""><blockquote type="cite" class=""><div class="">On 15 Feb 2016, at 17:45, Chris Lattner 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="">On Feb 15, 2016, at 12:49 AM, Paul Ossenbruggen via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:<br class=""><div class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><div class=""><div class=""><div style="margin: 0px; line-height: normal;" class=""><div style="margin: 0px; line-height: normal;" class=""><div style="color: rgb(79, 129, 135); font-family: Menlo; margin: 0px; line-height: normal;" class=""><br class=""></div><div class=""><span style="color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: inherit;" class="">The ? operator is unwrapped and the appendContentsOf method is only executed if the value is non-nil. </span><font color="#333333" face="Helvetica Neue, Helvetica, Segoe UI, Arial, freesans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol" size="3" class=""><span style="background-color: rgb(255, 255, 255);" class="">However you can not do the following, which seems natural:</span></font></div><div class=""><font color="#333333" face="Helvetica Neue, Helvetica, Segoe UI, Arial, freesans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol" size="3" class=""><br class=""></font></div></div></div></div></div></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class=""><div class=""><div class=""><div style="margin: 0px; line-height: normal;" class=""><div style="margin: 0px; line-height: normal;" class=""><div class=""><span style="font-family: Menlo;" class="">a? + b</span></div></div></div></div></div></div></blockquote></div></div></blockquote><div class=""><br class=""></div><div class="">FWIW, "a?” is the degenerate form of the optional chaining operation, which tests A, conditionally extracts its value, then re-wraps it back up without performing any other operations on it. It is equivalent to “a?.identity()”. The compiler rejects it because it is confusing/surprising for people, not because it is undefined.</div><div class=""><br class=""></div><div class="">I would be very concerned with defining this operation to mean something else, because that introduces inconsistency and a completely different kind of surprise to the language.</div></div></div></div></blockquote><blockquote type="cite" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><blockquote type="cite" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class=""><div class=""><div class=""><div style="margin: 0px; line-height: normal;" class=""><div style="margin: 0px; line-height: normal;" class=""><div class=""><div class=""><br class=""></div></div></div></div></div></div></div></blockquote><div class=""><div class=""><div class=""><div style="margin: 0px; line-height: normal;" class=""><div style="margin: 0px; line-height: normal;" class=""><div class=""><font color="#333333" face="Helvetica Neue, Helvetica, Segoe UI, Arial, freesans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol" size="3" class="">To address this, the nil-coalescing operator would allow $$, where $$ is the unwrapped unnamed result of the expression when non nil: </font></div></div></div></div></div></div></div></blockquote><br class=""></div><div class="">Just to point one thing out, ?? is an operator in the stdlib. Doing something like this would require baking it into the compiler.</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">IMO, the problem you’re addressing is already adequately solved by guard.</div><div class=""><br class=""></div><div class="">-Chris</div></div></blockquote></div></body></html>