<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="">As of today, this is possible:<div class=""><br class=""></div><div class=""><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(186, 45, 162);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">prefix</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> </span><span style="font-variant-ligatures: no-common-ligatures" class="">operator</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> ¬</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">prefix</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">func</span><span style="font-variant-ligatures: no-common-ligatures" class=""> ¬ (value: </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Bool</span><span style="font-variant-ligatures: no-common-ligatures" class="">) -&gt; </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Bool</span><span style="font-variant-ligatures: no-common-ligatures" class=""> {</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">return</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #3e1e81" class="">!</span><span style="font-variant-ligatures: no-common-ligatures" class="">value</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">}</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; min-height: 14px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(186, 45, 162);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">let</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> t = </span><span style="font-variant-ligatures: no-common-ligatures" class="">true</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">let</span><span style="font-variant-ligatures: no-common-ligatures" class=""> f = </span><span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">¬</span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">t</span></div></div><div class=""><br class=""></div><div class="">I have to admit that I quite like this but it has a couple drawbacks:</div><div class="">1: if you've never seen the ¬ operator in math it makes no more sense than "!"</div><div class="">2: It's quite tricky to find on your keyboard depending on your layout</div><div class="">3: maybe ~ is a better fit?</div><div class=""><br class=""></div><div class="">Seems like a lot of work for a very small improvement. But I'm all for it.</div><div class=""><br class=""></div><div class="">André</div><div class=""><br class=""></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 15 Feb 2017, at 22:28, Derrick Ho 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="">There is no need to change it<br class=""><br class="">Since the context basically disambiguates the meaning of !<br class=""><br class="">The next best thing is to compare it to false<br class=""><br class="">(val == false) // same as !val<br class=""><div class="gmail_quote"><div dir="ltr" class="">On Wed, Feb 15, 2017 at 3:02 PM David Waite via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="gmail_msg">If someone came with a nice syntax I’d be for this. I can’t imagine what that would be.<div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">I doubt there is an alternate prefix or postfix operator that would pass muster, due to ‘!’ already meaning the appropriate thing in so many languages, and swift only supporting symbolic operators.</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">I can’t think of a method on boolean which would read properly either, e.g.</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"><span class="m_-8132155900057031411Apple-tab-span gmail_msg" style="white-space:pre-wrap">        </span>if isValid.not() {…}</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">The closest I could think to a decent bike shed color would be a global function:</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"><span class="m_-8132155900057031411Apple-tab-span gmail_msg" style="white-space:pre-wrap">        </span>if not(isValid) {…}</div></div><div style="word-wrap:break-word" class="gmail_msg"><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">-DW</div></div><div style="word-wrap:break-word" class="gmail_msg"><div class="gmail_msg"><div class="gmail_msg"><br class="gmail_msg"><div class="gmail_msg"><blockquote type="cite" class="gmail_msg"><div class="gmail_msg">On Feb 15, 2017, at 11:10 AM, Robert Widmann via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a>&gt; wrote:</div><br class="gmail_msg m_-8132155900057031411Apple-interchange-newline"><div class="gmail_msg"><div dir="auto" class="gmail_msg"><div class="gmail_msg">So you've identified the problem, but what do you propose as a solution here? &nbsp;</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">It should be noted that a (non-stdlib) language-level answer to this question has already been discussed and rejected (<a href="https://lists.swift.org/pipermail/swift-evolution/2015-December/000032.html" class="gmail_msg" target="_blank">https://lists.swift.org/pipermail/swift-evolution/2015-December/000032.html</a>).</div><div class="gmail_msg"><br class="gmail_msg"><div class="gmail_msg">~Robert Widmann</div></div><div class="gmail_msg"><br class="gmail_msg">2017/02/15 9:02、Sadiq via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a>&gt; のメッセージ:<br class="gmail_msg"><br class="gmail_msg"></div><blockquote type="cite" class="gmail_msg"><div class="gmail_msg"><div dir="ltr" class="gmail_msg">Hello,<div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">I would like to suggest to change Logical NOT Operator from ! to something else.&nbsp;</div><div class="gmail_msg">It will increase the readability of the code and will avoid any confusion with the symbol used for force unwrapping of optional values.&nbsp;</div><div class="gmail_msg">It would be easier for new programmers to learn Swift as the first language.&nbsp;</div><div class="gmail_msg">I don't understand the rational behind using the same operator for two different purposes.&nbsp;</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">Thanks and Regards,</div><div class="gmail_msg">Mohammad Sadiq</div></div>
</div></blockquote><blockquote type="cite" class="gmail_msg"><div class="gmail_msg"><span class="gmail_msg">_______________________________________________</span><br class="gmail_msg"><span class="gmail_msg">swift-evolution mailing list</span><br class="gmail_msg"><span class="gmail_msg"><a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a></span><br class="gmail_msg"><span class="gmail_msg"><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="gmail_msg" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br class="gmail_msg"></div></blockquote></div>_______________________________________________<br class="gmail_msg">swift-evolution mailing list<br class="gmail_msg"><a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a><br class="gmail_msg"><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="gmail_msg" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="gmail_msg"></div></blockquote></div><br class="gmail_msg"></div></div></div>_______________________________________________<br class="gmail_msg">
swift-evolution mailing list<br class="gmail_msg">
<a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a><br class="gmail_msg">
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" class="gmail_msg" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="gmail_msg">
</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></body></html>