<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto">I was really surprised when I saw that the release of 4.0 introduced this 3.2 version to mean “the 4.0 compiler running in 3.1 compatibility mode”. So of course, I’m even more surprised to see a new 3.3 version. I find it very counter-intuitive. It also means we will continue to have to increment all previous Swift language versions from now on whenever a new compiler is released:<div><br></div><div>Swift 3.4 = Swift 5 compiler in Swift 3 compatibility mode</div><div>Swift 4.2 = Swift 5 compiler in Swift 4 compatibility mode</div><div>Swift 3.5 = Swift 5.1 compiler in Swift 3 compatibility mode</div><div>Swift 4.3 = Swift 5.1 compiler in Swift 4 compatibility mode</div><div><div><br></div><div>I have the impression that what we really need is a different directive to test for the compiler version:</div><div><br></div><div>#if compiler(&gt;=4.1)</div><div>// Swift 3.3</div><div>// Swift 4.1</div><div>#endif</div><div><div><div><br>On 6 Jan 2018, at 01:19, Jordan Rose via swift-build-dev &lt;<a href="mailto:swift-build-dev@swift.org">swift-build-dev@swift.org</a>&gt; wrote:<br><br></div><blockquote type="cite"><div><meta http-equiv="Content-Type" content="text/html; charset=us-ascii">Hi, all. Swift 4.1 is off on its own branch and going well, but we never quite came up with an answer for a particular problem developers might have: "am I running a Swift 4.1 <i class="">compiler?".</i><div class=""><i class=""><br class=""></i></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class="">#if swift(&gt;=3.2)</div></blockquote><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class="">// Swift 3.2 (4.0 in compatibility mode)</div><div class="">// Swift 3.3 (4.1 in compatibility mode)</div><div class="">// Swift 4.0</div><div class="">// Swift 4.1</div><div class="">#endif</div><div class=""><br class=""></div><div class="">#if swift(&gt;=3.3)</div><div class="">// Swift 3.3 (4.1 compatibily mode)</div><div class="">// Swift 4.0</div><div class="">// Swift 4.1</div><div class="">// this one is probably not very useful</div><div class="">#endif</div><div class=""><br class=""></div><div class="">#if swift(&gt;=4.0)</div><div class="">// Swift 4.0</div><div class="">// Swift 4.1</div><div class="">#endif</div></blockquote><div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class="">#if ???</blockquote><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class="">// Swift 3.3</blockquote><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class="">// Swift 4.1</blockquote><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class="">#endif</blockquote><div class=""><br class=""></div>I don't think this is going to come up a <i class="">lot,</i>&nbsp;but given that we do have changes to the standard library and to the language, I can see people wanting it. Right now the only way to do it is the rather unwieldy:<div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class="">#if swift(&gt;=4.1) || (swift(&gt;=3.3) &amp;&amp; !swift(&gt;=4.0))</div><div class="">print("new")</div><div class="">#else</div><div class="">print("old")</div><div class="">#endif</div></blockquote><div class=""><br class=""></div>Do we need something better here, or do you think people will be okay with this? I'm realizing I don't really know how many people try to keep their libraries working across Swift versions <i class="">and</i>&nbsp;run into compatibility issues.&nbsp;<br class=""><div class=""><div class=""><div class=""><div class=""><br class=""></div><div class="">(Strictly speaking this problem is already present with Swift 4.0.2 with 3.2.2 compatibility mode, but that's much less likely to come up.)</div></div></div></div><div class=""><br class=""></div><div class="">Jordan</div></div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>swift-build-dev mailing list</span><br><span><a href="mailto:swift-build-dev@swift.org">swift-build-dev@swift.org</a></span><br><span><a href="https://lists.swift.org/mailman/listinfo/swift-build-dev">https://lists.swift.org/mailman/listinfo/swift-build-dev</a></span><br></div></blockquote></div></div></div></body></html>