<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div><blockquote type="cite" class=""><div class="">On 4 Oct 2017, at 11:42, Mike Kluev 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 dir="ltr" class=""><span style="font-size:12.800000190734863px" class="">on Tue, 3 Oct 2017 11:00:33 -0600 </span><span style="font-size:12.800000190734863px" class="">Dave DeLong <</span><a href="mailto:swift@davedelong.com" style="font-size:12.800000190734863px" class="">swift@davedelong.com</a><span style="font-size:12.800000190734863px" class="">></span><br style="font-size:12.800000190734863px" class=""> wrote:<div class=""><span style="font-size:12.800000190734863px" class=""><br class=""></span></div><div class=""><span style="font-size:12.800000190734863px" class="">> Because, ideally, I’d love to be able to do:</span><br style="font-size:12.800000190734863px" class="">> <br style="font-size:12.800000190734863px" class=""><span style="font-size:12.800000190734863px" class="">> infix operator and: LogicalConjunctionPrecedence // or whatever the precedence is called</span><br style="font-size:12.800000190734863px" class=""><span style="font-size:12.800000190734863px" class="">> func and(lhs: Bool, rhs: Bool) → Bool { return lhs && rhs }</span><br style="font-size:12.800000190734863px" class="">> <br style="font-size:12.800000190734863px" class=""><span style="font-size:12.800000190734863px" class="">> let truthyValue = true and false</span><div class="gmail_extra"><br class=""></div><div class="gmail_extra">+1 (i like your thinking, even if it is unlikely to happen in swift)</div><div class="gmail_extra"><br class=""></div><div class="gmail_extra">(noteworthy, your example used "RIGHTWARDS ARROW" (U+2192) instead of ->, whether on purpose or not.)</div></div><div class="gmail_extra"><br class=""></div><div class="gmail_extra">speaking of &&, was it just a copy-paste from C or is there a more fundamental reason to use that instead of &? in C they had to use two different operators because of the implicit int <-> bool promotions, but in swift "true & false" vs "1 & 2" would have been distinguishable.</div></div></div></blockquote><br class=""></div><div>The difference between the & and && operators isn't to do with the implicit conversions; it's to do with whether both sides of the expression are evaluated or not.</div><div><br class=""></div><div>false && system('rm -rf')</div><div><br class=""></div><div>You really don't want to do that if both sides are executed ...</div><div><br class=""></div><div>Alex</div><br class=""></body></html>