<div dir="ltr">Changes to Swift syntax aren&#39;t really in scope for the Swift 4 Stage 1 evolution process. See this list:<div><a href="https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20160725/025676.html">https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20160725/025676.html</a></div><div class="gmail_extra"><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Aug 6, 2016 at 2:37 AM, Darren Mo via swift-evolution <span dir="ltr">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Consider code like<br>
<br>
guard !parameters.contains(where: { !validValueRange.contains($0) }) else …<br>
<br>
Oftentimes I need to write negation expressions like this. The location of the exclamation marks really bugs me when writing and reading this code. The natural English ordering would be something like<br>
<br>
“Make sure parameters does not contain an element such that validValueRange does not contain this element.”<br>
<br>
But the programming-language-imposed ordering is<br>
<br>
“Make sure NOT parameters contains an element such that NOT validValueRange contains this element.”<br>
<br>
See how much harder the programming language version is to understand? Most of the time I write the positive version first because it comes out so naturally, and then I add the exclamation marks afterwards. It really burdens my mind every time I need to write code like this. Let’s come up with a solution to address this!<br>
<br>
Here’s my zero-thought solution:<br>
<br>
guard parameters.!contains(where: { validValueRange.!contains($0) }) else …<br>
<br>
I’d love to hear alternate solutions and whether other people are having this problem too!<br>
<br>
Darren<br>
______________________________<wbr>_________________<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/<wbr>mailman/listinfo/swift-<wbr>evolution</a><br>
</blockquote></div><br></div></div>