<div dir="ltr"><div>`!` is already a de-facto postfix operator and is called optional force-unwrapping.</div><div>Although it is currently defined not as an operator function, but, oddly enough, as a special case in Swift grammar.</div><div>There are more things that may deserve this operator: for example, Result&lt;T, E&gt; would force-return T.</div><div><br></div><div>Operator `-&gt;` (Arrow) would find a great use in functional programming libraries (hello Haskell lovers).</div><div><br></div><div>As for operator `?`, it can be used to turn some custom type into optional. For example, Result&lt;T, E&gt; into Optional&lt;T&gt;.</div><div><br></div><div>I would also argue that such operators are unambiguous to their users.</div><div>If you define such custom operators and add operator functions for them, then you definitely know what they mean for you.</div><div><br></div>- Anton</div><div class="gmail_extra"><br><div class="gmail_quote">2016-04-11 0:03 GMT+03:00 Jean-Daniel Dupas <span dir="ltr">&lt;<a href="mailto:mailing@xenonium.com" target="_blank">mailing@xenonium.com</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><span class=""><blockquote type="cite"><div>Le 10 avr. 2016 à 15:01, Антон Жилин via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; a écrit :</div><br><div><div dir="ltr"><code style="font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:13.6px;padding:0.2em 0px;margin:0px;border-radius:3px;color:rgb(51,51,51);background-color:rgba(0,0,0,0.0392157)">&amp;</code><span style="color:rgb(51,51,51);font-family:&#39;Helvetica Neue&#39;,Helvetica,&#39;Segoe UI&#39;,Arial,freesans,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;font-size:16px;line-height:25.6px"> (as a prefix operator), </span><code style="font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:13.6px;padding:0.2em 0px;margin:0px;border-radius:3px;color:rgb(51,51,51);background-color:rgba(0,0,0,0.0392157)">-&gt;</code><span style="color:rgb(51,51,51);font-family:&#39;Helvetica Neue&#39;,Helvetica,&#39;Segoe UI&#39;,Arial,freesans,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;font-size:16px;line-height:25.6px">, </span><code style="font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:13.6px;padding:0.2em 0px;margin:0px;border-radius:3px;color:rgb(51,51,51);background-color:rgba(0,0,0,0.0392157)">?</code><span style="color:rgb(51,51,51);font-family:&#39;Helvetica Neue&#39;,Helvetica,&#39;Segoe UI&#39;,Arial,freesans,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;font-size:16px;line-height:25.6px">, and </span><code style="font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:13.6px;padding:0.2em 0px;margin:0px;border-radius:3px;color:rgb(51,51,51);background-color:rgba(0,0,0,0.0392157)">!</code><span style="color:rgb(51,51,51);font-family:&#39;Helvetica Neue&#39;,Helvetica,&#39;Segoe UI&#39;,Arial,freesans,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;font-size:16px;line-height:25.6px"> (as a postfix operator)</span><br><div><br></div><div>This is the list of built-ins that look like operators, but are banned from use as Swift custom operators.</div><div><br></div><div>We can review that list.</div><div><br></div><div>`&amp;` reserved as a prefix operators for a reason. It marks a variable use as `inout`, which currently cannot be done by any Swift operator function.</div><div><br></div><div>Other three don&#39;t have such justification.</div><div><br></div><div>`-&gt;`, `?` and `!` are used in types, but they are mostly unambiguous in expressions.</div><div><br></div><div>The only use of `!` in expressions can be rewitten as a built-in operator function:</div><div>postfix func ! &lt;T&gt; (left: T!) -&gt; T</div><div><br></div><div>`?` is used in optional method calls:</div><div>a.method?(b)</div><div>A parallel proposal is going to remove such syntax from Swift, so this will not be a problem.</div><div><br></div><div>`?` is also used in patterns:</div><div>if case x? = optional { ... }</div><div><br></div></div></div></blockquote><div><br></div></span><div>While the use is unambiguous for the compiler, I’m not sure it’s going to be unambiguous for code readers. Having the same operator meaning different things depending the context is a bad idea IMHO.</div></div><br></div></blockquote></div><br></div>