<html><head><style>body{font-family:Helvetica,Arial;font-size:13px}</style></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">Consider the following:</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;"><br></div><div id="bloop_customfont" style="margin: 0px;"><div id="bloop_customfont" style="margin: 0px;"><font face="Courier" color="#9437ff">protocol Updatable {</font></div><div id="bloop_customfont" style="margin: 0px;"><font face="Courier" color="#9437ff"> func update(state: Bool)</font></div><div id="bloop_customfont" style="margin: 0px;"><font face="Courier" color="#9437ff">}</font></div><div id="bloop_customfont" style="margin: 0px;"><font face="Courier" color="#9437ff"><br></font></div><div id="bloop_customfont" style="margin: 0px;"><font face="Courier" color="#9437ff">class Thing: Updatable {</font></div><div id="bloop_customfont" style="margin: 0px;"><font face="Courier" color="#9437ff"> private var enabled = false</font></div><div id="bloop_customfont" style="margin: 0px;"><font face="Courier" color="#9437ff"> </font></div><div id="bloop_customfont" style="margin: 0px;"><font face="Courier" color="#9437ff"> func update(state: Bool) {</font></div><div id="bloop_customfont" style="margin: 0px;"><font face="Courier" color="#9437ff"> self.enabled == state</font></div><div id="bloop_customfont" style="margin: 0px;"><font face="Courier" color="#9437ff"> }</font></div><div id="bloop_customfont" style="margin: 0px;"><font face="Courier" color="#9437ff">}</font></div><div id="bloop_customfont" style="margin: 0px;"><br></div><div id="bloop_customfont" style="margin: 0px;">The obvious intention is to set <font color="#9437ff" face="Courier">self.enabled</font> to the incoming value of <font color="#9437ff" face="Courier">state</font>. However, it’s easy to accidentally type a second equals sign. The effect of this typo is <font color="#9437ff" face="Courier">self.enabled</font> is never updated, leading to a run-time bug that could be difficult to diagnose. </div><div id="bloop_customfont" style="margin: 0px;"><br></div><div id="bloop_customfont" style="margin: 0px;">This typo doesn’t generate any errors or warnings. I can’t think of a valid reason to use the equals function outside of comparisons. If the compiler instead treated this typo as an error, the mistake would be trivial to identify and fix:</div></div><div><br></div><div><div id="bloop_customfont" style="margin: 0px;"><font face="Courier" color="#9437ff">protocol Updatable {</font></div><div id="bloop_customfont" style="margin: 0px;"><font face="Courier" color="#9437ff"> func update(state: Bool)</font></div><div id="bloop_customfont" style="margin: 0px;"><font face="Courier" color="#9437ff">}</font></div><div id="bloop_customfont" style="margin: 0px;"><font face="Courier" color="#9437ff"><br></font></div><div id="bloop_customfont" style="margin: 0px;"><font face="Courier" color="#9437ff">class Thing: Updatable {</font></div><div id="bloop_customfont" style="margin: 0px;"><font face="Courier" color="#9437ff"> private var enabled = false</font></div><div id="bloop_customfont" style="margin: 0px;"><font face="Courier" color="#9437ff"> </font></div><div id="bloop_customfont" style="margin: 0px;"><font face="Courier" color="#9437ff"> func update(state: Bool) {</font></div><div id="bloop_customfont" style="margin: 0px;"><font face="Courier" color="#9437ff"> self.enabled == state // Error: `==` may not be used outside of comparisons</font></div><div id="bloop_customfont" style="margin: 0px;"><font face="Courier" color="#9437ff"> }</font></div><div id="bloop_customfont" style="margin: 0px;"><font face="Courier" color="#9437ff">}</font></div></div><div id="bloop_customfont" style="margin: 0px;"><font face="Courier" color="#9437ff"><br></font></div><div id="bloop_sign_1452544181868712960" class="bloop_sign"><div style="font-family:helvetica,arial;font-size:13px">-- <br>Jared Sinclair<br>Sent with Airmail</div></div></body></html>