<div dir="ltr">Lua is also quite popular and doesn't support the "!" operator but the "not" keyword instead.<div>Adapting to that wasn't all that difficult for me when writing Lua for a while. You rarely have to think about what a negation looks like because "not" just comes to mind naturally. It's like you're writing regular text in that moment.</div><div><br></div><div>In any case such a decision should not depend primarily on whether a specific operator or keyword is common in other languages but whether it helps expressing and understanding the code's intent. "not" achieves that, esp. for newbies and people getting someone else's code.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Dec 15, 2015 at 7:45 PM, Paul Cantrell via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span> wrote:<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"><div>Though the “! means negation” operators are too widely used and too elegant for me to get behind this change, I would say a word in favor of Swift’s loose convention of “! means danger:”</div><div><br></div><div><span style="white-space:pre-wrap">        </span>! (force unwrap)</div><div><span style="white-space:pre-wrap">        </span>! (IUO)</div><div><span style="white-space:pre-wrap">        </span>as!</div><div><span style="white-space:pre-wrap">        </span>try!</div><div><br></div><div>…all mean “potential crash here.” That’s a nice convention.</div><div><br></div><div>However, because not all potential crash points are marked with ! (array subscripting, assert / precondition / fatalError, and of course any function that contains one of the above crashing constructs), we can’t say “danger implies !”. It thus doesn’t seem worth the pain of removing the !, != and !== operators to make the “! implies danger” association strong.</div><div><br></div><div>Still, I’d be in favor of anything that helps me audit code for potential crash points — if not changing the negation operators, then perhaps something AST based, perhaps even library annotations. At the very least, I’d appreciate it if SourceKit / Xcode could apply different syntax coloring to the negation bang and the danger bang.</div><div><br></div><div>Cheers,</div><div><br></div><div>Paul</div><div><div class="h5"><div><br></div><br><div><blockquote type="cite"><div>On Dec 15, 2015, at 12:26 PM, Craig Cruden via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> wrote:</div><br><div><span style="font-family:HelveticaNeue;font-size:13px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">-1 as well. </span><div style="font-family:HelveticaNeue;font-size:13px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br></div><div style="font-family:HelveticaNeue;font-size:13px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">I cannot think of a language where I don’t have ! as negate (which I read as not).</div><div style="font-family:HelveticaNeue;font-size:13px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br></div><div style="font-family:HelveticaNeue;font-size:13px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">What would it be replaced by a keyword of “not”? </div><div style="font-family:HelveticaNeue;font-size:13px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br></div><div style="font-family:HelveticaNeue;font-size:13px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br><div><br></div><div><br><div><blockquote type="cite"><div>On 2015-12-16, at 1:18:14, Austin Zheng via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> wrote:</div><br><div><div dir="ltr" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">-1. In terms of C features that people complain about, prefix '!' for negation doesn't seem to be high on the list, and it's never something that has caused me or any other developer I know a problem (although these are all anecdotes, take them as you will). A linter/style checker can always be used if you really want to enforce 'x == false' over '!x' for your team or project.<div><br></div><div>'~' is already used for bitwise negation.<br><div><div><br></div><div>More broadly, in terms of "words" vs "cryptic symbols" as operators, I am strongly against the former and for the latter. The symbols are 'cryptic' for the few minutes it takes to figure out what they mean, after which the developer is good for a lifetime of coding in many different languages. The words are nicely self-descriptive for a bit, then increase verbosity and destroy your ability to visually delineate arguments via symbols forever.</div><div><br></div><div>Best,</div><div>Austin</div><div><br></div></div></div></div><div class="gmail_extra" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br><div class="gmail_quote">On Tue, Dec 15, 2015 at 9:59 AM, ilya via swift-evolution<span> </span><span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span><span> </span>wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="white-space:pre-wrap"><span>> For example in `if let aBool = aBool where !aBool`, let's suppose that we know that `aBool` optional it's not empty before this check. How would you write it? `!aBool!` or with the `if let...` ?<br><br></span>if aBool == false {} covers this nicely. <br><br>As for the whole topic of words vs cryptic symbols for Boolean operators I'm agnostic on what's best but imho we need to have consistency. E.g. either all words, or all math symbols or all the same as in C (current state of things). <br><br>You can always rewrite !x as (x==false) if x is a Bool and forced unwrapping is undesirable anyway so the confusion can be minimized in practice. <br><br>Ilya. </div><br><div class="gmail_quote"><div><div><div dir="ltr">On Tue, Dec 15, 2015 at 19:56 Bruno Berisso via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> wrote:<br></div></div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div><div dir="ltr">I also hit the <b>!=</b> vs <b><></b> dilema and conclude that we could continue using the <b>!=</b> as "not equal".<div><br><div>It's true that it will not be as consistent as before but I think it's a reasonable price to pay taking into account the issues with <b>!</b> as 'not'. </div></div><div class="gmail_quote"></div></div><div dir="ltr"><div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div>Not that I necessarily think this proposal is a good idea. The given examples reek of being against unwrapping for some reason.</div><div><br></div><div>Why not use `if let aBool = aBool where !aBool`? And `if let someValue = someValue where !(otherBoolValue && someValue > 0)`?</div></div></blockquote><div><br></div></div></div><div dir="ltr"><div class="gmail_quote"><div>I think the issue is the complete different meanings of a symbol depending only in where it appears in an expression. Adding that<span> </span><b>!</b>character is really easy to miss in an expression make it at last uncomfortable.</div><div><br></div><div>I agree that we are all really used to find<span> </span><b>!</b> in logical expressions and our brain is trained to translate it to NOT automatically but that doesn't mean that it's good idea to keep it there.</div><div><br></div><div>For example in `if let aBool = aBool where !aBool`, let's suppose that we know that `aBool` optional it's not empty before this check. How would you write it? `!aBool!` or with the `if let...` ?</div><div><br></div><div>I think that clearly <b>!</b> is not good choice for negation but my mind is so used to it that I can't totally affirm that<span> </span><b>not</b> is<span> </span><i>the</i> alternative to it. Do we have another alternatives?</div><div><br></div><div><br></div></div></div></div></div><span><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=1p9Jer2O6jVE9KWvo-2B9iUaEyN8slp4IizyiLwsfp54PuIzNf98bk9mcnC9MK7FuAPQNbQF3aF2V9-2FQxdv0tdx7naNusXiMhFu3qrjivt3BLVtqWXFzZ1XAWEnCs1zO1TZLDPbZdBIf9TIa0mm3jX0MaVOjmGwLH1xMACTcDCvU3FwAFA4Pjpqa-2BzuaN-2BMKzlF8DNzNAlzIO4VGhbyz0Xrs3BBz1Mbida-2F5r-2FViPBAKg-3D" alt="" width="1" height="1" border="0" style="min-height:1px!important;width:1px!important;border-width:0px!important;margin:0px!important;padding:0px!important"><span> </span>_______________________________________________<br>swift-evolution mailing list<br><a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br></span></blockquote></div><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=7XtDdMHRjqIUi4tzSjSp2pWQIyxYdP6woIWn4vwV5geIOhhDHxMMCUhvHPhaVWjPNeRHPSenv8r1esqoqbPEaSfHyMIe3SGKGNytJ8wy6T83l-2FxBDb7W8MmboUird6-2FVWyZLW24ySHlrl5ftEeIs04vweZ10rgMN5WbRSRqfIatjOa55a3n3c5eygu6R-2BTfc-2FDATUfZVVCJt5tfeecM1T-2FYHJDkBD93RJZdUNO2Nyek-3D" alt="" width="1" height="1" border="0" style="min-height:1px!important;width:1px!important;border-width:0px!important;margin:0px!important;padding:0px!important"><span> </span><br>_______________________________________________<br>swift-evolution mailing list<br><a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br><br></blockquote></div><br></div><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=CGU22LnxbYa2EM3wKvzuC6syQDwKa0tMs5IyT5gL1wIhcvKUEimjNAVNfW3KOd3djW-2FGC8V8q5Gf78trcTZb6yKTnWTVz85Y3hbS-2BNoHs9LzWqEm4CgYp6x793oSgKcgjlRkRasg39bd3g1iQA3ZJy-2BckJDtgOpkFZXaDtHt4i4zaoW4PSRVZwCY-2FnVYYYRsdsUEUV6sm-2BlQ-2F23Dmj6g7d7bd-2F2AgkDPQcnrhJwcP3c-3D" alt="" width="1" height="1" border="0" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;min-height:1px!important;width:1px!important;border-width:0px!important;margin:0px!important;padding:0px!important"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important"><span> </span>_______________________________________________</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">swift-evolution mailing list</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><a href="mailto:swift-evolution@swift.org" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">swift-evolution@swift.org</a><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a></div></blockquote></div><br></div></div><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=zCg-2FSGF9Wk188a6c55kLyEbrj7YhaXxFEHM-2F-2B0YAlzUgLB68Keg7OQMRVbhFHuk1o7fFYGubd75IQSFk9Xyn3-2BJehcE-2BZQsFNcSGeiSeWgIbuWXyT-2BcCXo-2F19YABwA2AtWLhv5oZ8HyI6ewYTRv7otu0Up3Qw0dOg3iGuDrUK3bRKXaBp8ZPXbRlDLM2m9IZJWd5x80QrxS-2FLyP1qmvpgVyj2T-2FHRd1kP1zSLDFcFAw-3D" alt="" width="1" height="1" border="0" style="font-family:HelveticaNeue;font-size:13px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;min-height:1px!important;width:1px!important;border-width:0px!important;margin:0px!important;padding:0px!important"><span style="font-family:HelveticaNeue;font-size:13px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important"><span> </span>_______________________________________________</span><br style="font-family:HelveticaNeue;font-size:13px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:HelveticaNeue;font-size:13px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">swift-evolution mailing list</span><br style="font-family:HelveticaNeue;font-size:13px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><a href="mailto:swift-evolution@swift.org" style="font-family:HelveticaNeue;font-size:13px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">swift-evolution@swift.org</a><br style="font-family:HelveticaNeue;font-size:13px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" style="font-family:HelveticaNeue;font-size:13px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a></div></blockquote></div><br>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=6ZGE61OxINd5lLe2xYh9Ku-2BXbixWNr2nvfzp2IB1sZhakNXdEW1IMYZ2j1WBSjZLVagD8cfLTgMI5T3-2Fs2hu8zRUOngBiEr9K1Cj1kIaDPFX0Ywdr1lwTUPURg9-2FPcDz7VHKgbxvWcMCahEJCTc5pXuig2IKwyxyC4rj2fn1thuTEXgaKgGqMNIgjehLU7geetTAaS5iOQ8oda0F2kXp7wROc0fQ1wM4iig0fW4dSH4-3D" alt="" width="1" height="1" border="0" style="min-height:1px!important;width:1px!important;border-width:0!important;margin-top:0!important;margin-bottom:0!important;margin-right:0!important;margin-left:0!important;padding-top:0!important;padding-bottom:0!important;padding-right:0!important;padding-left:0!important">
</div></div></div>
<br>_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
<br></blockquote></div><br></div>