<div dir="ltr">Andrew, we could theoretically implement `not`-negation and continue to use != until a better solution is found. Baby steps and all that.<div><br></div><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><br><div class="gmail_quote"><div dir="ltr">On Tue, Dec 15, 2015 at 10:19 AM Andrew Brown via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div>I'm interested to hear what the opinions are for this.</div><div>When I first read the idea I was a definite NO! (See what I did there :) )</div><div>But after thinking about it I'm interested to hear how people feel about this.</div><div>The obvious issue is what do we do with '!=' ?</div><div>Most languages which do not use ! for negation use '<>' for '!=' and I'm no sure how popular that would be.</div><div><br></div><div>ABR.</div></div><div dir="auto"><div><br>On 15 Dec 2015, at 15:01, Marc Knaup via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr">I'm uncertain but it's definitely worth considering.<div><br><div>I also think that it's weird at the moment since in most cases the exclamation mark is now something dangerous.</div></div><div>I also had a couple of bugs in my code because the operator is too easy to miss and the negation was not or no longer intended.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Dec 15, 2015 at 3:11 PM, Bruno Berisso 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 dir="ltr">Hello,<div><br></div><div>I'm really used to negate logical expressions with this operator but it never feels confortable to me. If I need to negate some complex expression sometimes I prefer to write a temporal variable and then negate that with <b>!</b> because I fear than others, or myself, could overlook it and cause confusion.</div><div><br></div><div>Now that Swift use the same operator to force the unwrap of optional values it becomes even worse.</div><div><br></div><div>Consider this examples:</div><div><br></div><div>if someOptionalValue != nil {</div><div> ...</div><div> if !(otherBoolValue && someOptionalValue! > 0) {</div><div> ...</div><div> }</div><div>}</div><div><br></div><div>Or even worse, what happen when negating Optional<Bool> values?</div><div><br></div><div>//Best case</div><div>if let value = optionalBool where !value {</div><div> ...</div><div>}</div><div><br></div><div>//Worse case</div><div>if !optionalBool! {</div><div> ...</div><div>}</div><div><br></div><div>Now what happen with this examples if we instead use a <b>not</b> operator:</div><div><br></div><div><div>if someOptionalValue != nil {</div><div> ...</div><div> if not (otherBoolValue && someOptionalValue! > 0) {</div><div> ...</div><div> }</div><div>}</div><div><br></div><div>if let value = optionalBool where not value {</div><div> ...</div><div>}</div><div><br></div><div>if not optionalBool! {</div><div> ...</div><div>}</div></div><div><br></div><div>I'm not sure if <b>not</b> is the right path here but I really want to improve the <b>!</b> to something more clear at a glance and that doesn't have different behaviour depending where it appears in an expression.</div><div><br></div><div>Thanks,</div></div>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=6ZGE61OxINd5lLe2xYh9Ku-2BXbixWNr2nvfzp2IB1sZiUK6bWllvEAW1nr0HIeUahbgxRTKL9Y15l4Vtk8B72J-2BZQXJRCmf-2B4azoEnD6bnKV5S7-2Bku6A5xCXRoBAJeopBSkIQTbcN8g2-2BePsmHiVp3qgaUWk2nUP-2Fwoi93r6jvWfWg3Kj7XQklxjLvSGlfXuW96qy459-2BFNfdsiHQ4a0wF02qeVSIfpWOCKLxzuwTvTk-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">
<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=XyCJWhfMItFjSNmahITOcyxV9JT9ZIrLvQ-2Bkm7FUBXvFmBnTyNwTNN2BKFpIKpSFWQ0koKWoAkPs-2BPWp2sYrmA5wrgXZl8xrd9Jj5MH9r2Mjksd0g3abkno3MURRDBfdiYn9zoepXBNxB41kV-2FZ89-2B-2Fnyd97V56d9g1L0Pyts3XDSzYAOOgXuxwUpnvEhebvleLc6c-2ByP6rEf1Eg5QRY6A-3D-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></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>swift-evolution mailing list</span><br><span><a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a></span><br><span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br></div></blockquote>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=8CZIdLciSFC-2BO5jF-2FiP8qN7dBFsgCUZ50wdTsolcRPe333C09AWAvUeTcBrAZilNSLXGeDzdkoB0vmsFtD1Rlbb2-2FLlt7fmIu14tDK7lmhTgDOGQs6y3mz-2FuT-2FmHUrb-2FEbZYyf5-2FrnQoUN-2B3j0jDmua-2FVnYuLqNvA5mFcCtQhy-2BEmwCGB32qT0Ydtv4Xv7ooWkP7C5RMCIUOAzzRqH-2FbvG6W9OFtei-2B2zTXQn6gfI8A-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>
_______________________________________________<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>
</blockquote></div>