<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div><blockquote type="cite" class=""><div class="">On Feb 7, 2017, at 11:19 PM, Martin Waitz via swift-build-dev <<a href="mailto:swift-build-dev@swift.org" class="">swift-build-dev@swift.org</a>> wrote:</div><div class=""><div class=""><br class=""><blockquote type="cite" class="">The review of SE-0151 “Package Manager Swift Language Compatibility Version" begins now and runs through February 13, 2017. The proposal is available here:<br class=""><br class=""><span class="Apple-tab-span" style="white-space:pre">        </span><a href="https://github.com/apple/swift-evolution/blob/master/proposals/0151-package-manager-swift-language-compatibility-version.md" class="">https://github.com/apple/swift-evolution/blob/master/proposals/0151-package-manager-swift-language-compatibility-version.md</a></blockquote></div></div></blockquote><div><br class=""></div><div>Thanks for providing feedback, Martin.</div><div><br class=""></div><div>When Swift's source compatibility plan defined (<a href="https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20161128/029099.html" class="">https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20161128/029099.html</a>), it included the point:</div><div><br class=""></div><div><blockquote type="cite" class="">The Swift Package Manager will allow package authors to specify a list of compatibility modes.</blockquote><div class=""><br class=""></div><div class="">This proposal provides a mechanism to implement that point.</div><div class=""><br class=""></div><div class="">I believe that the reason this was desired is because we expect that package authors may wish to conditionally adopt new Swift 4 language features without breaking their ability to build with Swift 3, using conditional compilation blocks, e.g. </div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>#if swift(>=4.0)</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>// Swift 4 code goes here</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>#endif</div><div class=""><br class=""></div><div class="">With this proposal, you can do this by specifying [3, 4], in which case the Swift 4 compiler will compile it as Swift 4 code, and use the code inside the conditional compilation block, while the Swift 3 compiler will also be able to compile it (as Swift 3 code), skipping the conditional compilation block.</div><div class=""><br class=""></div><div class="">If you were only able to specify "3" instead, the Swift 4 compiler would pass `-swift-version 3` when compiling this code, and would skip the conditional compilation block. As such it would not be possible to use any Swift 4 language features unless you set your Swift language compatibility version to "4", at which point it could no longer be built by the Swift 3 compiler.</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>- Rick</div><div class=""><br class=""></div></div><blockquote type="cite" class=""><div class=""><div class="">I’ve one question regarding this proposal:<br class="">Why use the list `swiftLanguageVersions` instead of a simple `swiftLanguageVersion: Int = 3`?<br class="">What’s the advantage of being able to specify `[3,4]`?<br class=""><br class="">If you already have a version 4 compiler, that one will be used anyway and if the source really is compatible with both versions,<br class="">it does not make any difference whether it will be run in version 3 or version 4 mode.<br class="">So just setting it to `3` has the same effect, right?<br class=""><br class="">I think it’s enough to specify something like „this source is intended to be compiled in swift version 3 mode“.<br class="">Most of the time, that’s all you can specify anyway, because you don’t know which future versions happen to be compatible.<br class=""></div></div></blockquote></div><br class=""></body></html>