<div dir="ltr"><div><div><div><div><div><div><div><div>I mentioned this in passing on a <a href="https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20161024/028371.html">different thread</a>. Although it caused some slight confusion when I first learned the &#39;guard&#39; keyword, it was easy to overcome and I didn&#39;t think the issue was strong enough to warrant a change. However, after reading the other discussion on that thread (around the possibility of a &#39;matches&#39; keyword and how code is &quot;read out&quot; or &quot;internally verbalised&quot;), and seeing how passionate everyone here is about Swift, I&#39;m thinking that maybe it should be changed.<br><br></div>The issue is that in English, &#39;guard&#39; has an inverted logical connotation to how it is used in Swift. For example, take this sentence:<br><br></div>&quot;In some functions it&#39;s a good idea is to put some checks in place, in order to guard against invalid input values.&quot;<br><br></div><div></div>Swift&#39;s &#39;guard&#39; keyword is to <b>guard</b> against <b>invalid</b> values.<br></div>Or to put it another way, to <b>ensure</b> that we have <b>valid</b> values.<br><br></div>However, the way it reads in Swift, we <b>guard</b> that we have <b>valid</b> values.<br><br></div>I fully understand and agree that it&#39;s better to state the <b>true</b> condition for <b>valid</b> values here, using <b>else</b> to perform a contingency. And I understand why the word &#39;guard&#39; was picked (given the above example sentence). I just think that &#39;ensure&#39; would be better.<br><br></div>ensure x &gt; 0 else {<br></div>    return<br><div>}<br><br></div><div>ensure camp.isSafe else {<br></div><div>    runForTheHills()<br>}<br></div><div><div><br></div><div>ensure let thingy = object as? Thingy else {<br></div><div>    return ExamineThingyResult.NotAThingy<br></div><div>}<br><br></div><div>As I said, I thought it was too small a niggle to worry about, but seeing how people on here care so much about making Swift better, and the willingness to change things, I thought I&#39;d suggest it. Although it would be a breaking change, the code changes are easy.<br><br></div><div>So what do people think? In particular it would be interesting to hear from non-native English speakers on this, did &#39;guard&#39; confuse you or did &#39;guard&#39; cause your understanding of the English word to be confused?<br></div><div><br></div></div></div>