<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="">I don’t think that solves the same thing. &nbsp;The problem is I read it is to allow some sort of short hand to be able to pass optional types as parameters into methods / initializers that do not take optional types. &nbsp;The result of that method / initializer being nil if any of said parameters were nil or a typical result otherwise. &nbsp;Based on your example I think it’s identical to the existing ?? operator, is it not?<div class=""><br class=""></div><div class="">As per the suggested syntax, I do think that we would want to be able to control this feature on a per parameter basis, so it would make sense to have the ? operator placed after the parameter that needed to be unwrapped. &nbsp;This would also be more consistent with the usage of the existing syntax.<br class=""><div class=""><br class=""></div><div class="">— Charles</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Dec 11, 2017, at 9:37 AM, C. Keith Ray 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 dir="auto" class="">You can create a binary operator that tests the left-hand operand for nil, and passes the unwrapped value to the right-hand operand (a function taking one value), this operator can be made left-associative to allow chaining.<br class=""><br class=""><div class=""><pre class=""><code class="" style="white-space: normal; background-color: rgba(255, 255, 255, 0);"><font face="UICTFontTextStyleTallBody" class="">let m = String(contentsOfFile: "README.md") ???&nbsp;</font></code><font face="UICTFontTextStyleTallBody" class=""><span style="white-space: normal; background-color: rgba(255, 255, 255, 0);" class="">Markdown&nbsp;</span></font></pre><pre class=""><font face="UICTFontTextStyleTallBody" class=""><span style="white-space: normal;" class="">where ??? is the operator described above.</span></font></pre><pre class=""><br class=""></pre></div><div class=""><span style="background-color: rgba(255, 255, 255, 0);" class="">--<br class="">C. Keith Ray</span><div class=""><span style="background-color: rgba(255, 255, 255, 0);" class=""><br class=""></span></div><div class=""><span style="background-color: rgba(255, 255, 255, 0);" class="">*&nbsp;<a href="https://leanpub.com/wepntk" class="">https://leanpub.com/wepntk</a>&nbsp;&lt;- buy my book?<br class="">*&nbsp;</span><a href="http://www.thirdfoundationsw.com/keith_ray_resume_2014_long.pdf" class="">http://www.thirdfoundationsw.com/keith_ray_resume_2014_long.pdf</a><span style="background-color: rgba(255, 255, 255, 0);" class=""><br class="">*&nbsp;<a href="http://agilesolutionspace.blogspot.com/" class="">http://agilesolutionspace.blogspot.com/</a></span></div></div><div class=""><br class="">On Dec 11, 2017, at 9:07 AM, Magnus Ahltorp via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:<br class=""><br class=""></div><blockquote type="cite" class=""><div class=""><span class=""></span><br class=""><blockquote type="cite" class=""><span class="">12 Dec. 2017 01:30 Jared Khan via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</span><br class=""></blockquote><blockquote type="cite" class=""><span class=""></span><br class=""></blockquote><blockquote type="cite" class=""><span class="">I'd like to propose a syntax addition that acts to ease some things that I believe should fall under the umbrella of 'optional chaining'. Optional chaining allows us to access the properties of an optional value and return nil if any link in that chain breaks. I propose we introduce syntax to allow similar chaining when passing optional valued parameters to functions that expect that parameter to be non-optional.</span><br class=""></blockquote><span class=""></span><br class=""><span class="">1. Am I right in assuming that you propose that the suffix operator "?" would make the result of the surrounding method/function call optional, so that a(b(c?)) would make the result of the "b" function call optional, but not the "a" function call, and that it would be a(b(c?)?) if we would like to propagate this two levels?</span><br class=""><span class=""></span><br class=""><span class="">2. If that is the case, is that understandable/neat enough? How common would you expect this to be?</span><br class=""><span class=""></span><br class=""><span class="">3. For some reason, (in current Swift) the suffix operator "?" seems to be allowed in intra-expression syntax, and only fails when the inter-expression syntax is checked for optionality congruence. Is there a reason for this? I would have expected that the congruence error "cannot use optional chaining on non-optional value of type" would never be seen for a lone "?", since the error message "'?' must be followed by a call, member lookup, or subscript" would always be displayed first if it was checked first. The "." operator checks intra-expression syntax first, before checking congruence. Is this a sign that "?" as a suffix operator is already somewhat operational as an operator for optional types? I have a faint recollection that it was doing something in earlier versions of Swift.</span><br class=""><span class=""></span><br class=""><span class="">/Magnus</span><br class=""><span class=""></span><br class=""><span class="">_______________________________________________</span><br class=""><span class="">swift-evolution mailing list</span><br class=""><span class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a></span><br class=""><span class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br class=""></div></blockquote></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=""></div></div></body></html>