<div dir="ltr">My vote is to leave "!" as is. I'd support changing the "unwrap" operator to something else.<div><br></div><div>Sprinkling "not" all over my source files seems noisy to me. Like AppleScript, it sounds good in theory, but in practice the code is no easier to read than before. </div><div><br></div><div>I find it kind of strange that the last couple years the internet suddenly views C language features with great suspicion. I have no problem with any of the C features that remain in Swift. I find far more confusing the remaining features and conventions from Obj-C and Cocoa.</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Dec 15, 2015 at 8:05 AM, Tommy van der Vorst 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>I do not see a problem with the '!' negation operator. The case with forced unwrap + negation doesn't happen very often, (in my opinion) doesn't look that bad, and certainly isn't confusing. The other example cases also look pretty clear to me. Usage of '!' for implicit unwrapping vs its usage for negation is well-separated (one being prefix, the other postfix). </div><div><br></div><div>I *do* see negative effects of removing it: ! is part of virtually all programming languages currently in use, any decent programmer is accustomed to it and read it like 'not' in their head anyway. Removing would definitely confuse newcomers to the language. </div><div><br></div><div>/T</div><br><div><blockquote type="cite"><div><div class="h5"><div>Op 15 dec. 2015, om 15:11 heeft Bruno Berisso via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> het volgende geschreven:</div><br></div></div><div><div><div class="h5"><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>
</div></div><span class=""><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=YfJegnDVHFjciv1mJPW79zu0hcjAYJ-2BpFoOAdq9R1JeEOjfztgrLfgHW6sn5aMshXoS0-2Bdx8HaIimenujn57LDfIn36kp6-2FBhdn-2BD4yWX4PuyRW-2BL0zvrMFV3uIsSg94mtB4i0DxxdW-2FtSMoVCfkzZAHmBxW3xa8lFO9ZAJx9rp1lbZI3FQy2bOFD8N3wgCvNY4Vhe8W6TvtyMoTZRKWISh-2BL96o6JW3fTlebv8-2BvRk-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>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" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br></span></div></blockquote></div><br>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=l3fs1g-2F466j3y5fD5Q61KddsTTCmXL0uxw3XoAMFFNiQizEc-2Fbhj73tylBCuJtPQfy3kWPFKkLKyByTkXl6XYWZ6-2BuX-2BPx-2FJXRzedhatIj2kqJSb1BRQhfkCiSLt0ILtNnSoS00wblnQLw1-2Bm0jSA-2BSAOUicq1NPM67D4lmJq9REVPfz3v5KlnkR1-2F0z1BIQZgsf5DV1CdJLhMyEhHNSLXiOo9TOITS-2FR6ahfGA-2B3Y4-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>_______________________________________________<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>