<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=""><div class="">I think this would make more sense if we were to get more characters in operators, such that we could also replace && with and, and || with or, this way we could make not an operator and write expressions like so:</div><div class=""><br class=""></div><div class=""><font face="Monaco" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>if foo and not bar { … }</font></div><div class=""><br class=""></div><div class="">Otherwise as others have said this seems strange as a method. If you don’t find the leading exclamation mark very readable then you could instead do:</div><div class=""><br class=""></div><div class=""><font face="Monaco" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>foo != true</font></div><div class=""><br class=""></div><div class="">It’s a few more characters, but it exists now and reads logically I think.</div><br class=""><div><blockquote type="cite" class=""><div class="">On 21 May 2016, at 15:50, Антон Миронов via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">I found negation operator (!) the least detectable among the code. So I’ve decided to add property “not” to BooleanType (Swift 2.2) or Boolean on 3.0 with extension:<div class=""><br class=""></div><div class="">extension BooleanType {</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>var not: Bool { return !self.boolValue }</div><div class="">}<br class=""><div class=""><div class=""><br class=""></div><div class="">This is code with negation operator:</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>return !self.lanes[position.y][currentLaneRange].contains(.Gap)</div></div></div><div class=""><div class=""><div class=""><br class=""></div><div class="">As I sad before negation operation is hard to spot. Moreover at first it looks like I’m trying to negate self for some reason.</div><div class=""><br class=""></div><div class="">This is code with “not” property:</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>return self.lanes[position.y][currentLaneRange].contains(.Gap).not</div></div></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class=""><br class=""></div></blockquote><div class=""><div class="">Now it is easy to spot the statement I am actually getting negation of.</div><div class="">On my experience negation operator can occasionally be missed while reading code. This happens less often with “not” property. So I’m proposing to add this property to standard library and prefer it in most cases.</div><div class=""><br class=""></div><div class="">Thanks,</div><div class="">Anton Mironov</div></div><div class=""><br class=""></div></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=""></body></html>