<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">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(>=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(>=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(>=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> 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(>=4.1) || (swift(>=3.3) && !swift(>=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> run into compatibility issues. <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></body></html>