<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 class="">When you file the bug, can you post the Jira number? The grammar in TSPL will also need to be changed to accept three version components.</div><div class=""><br class=""></div><div class=""><a href="https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/Statements.html#//apple_ref/swift/grammar/swift-version" class="">https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/Statements.html#//apple_ref/swift/grammar/swift-version</a></div><div class=""><br class=""></div><div class="">Thanks!</div><div class="">— Alex</div><div class=""><br class=""></div><br class=""><div><blockquote type="cite" class=""><div class="">On Oct 23, 2016, at 9:25 PM, Chris Lattner via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div style="font-family: Helvetica; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" class=""><div class=""><br class="Apple-interchange-newline">On Oct 22, 2016, at 2:44 PM, Richard Wei via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hi,<div class=""><br class=""></div><div class="">Foundation in 3.0-RELEASE didn't fully resolve the renaming in SE-0086, so we have `RegularExpression` on Linux and `NSRegularExpression` on macOS. The naming is now unified in Swift 3.0.1, but there doesn’t seem to be a possible way to resolve the code breaking change. Consider the example below:</div></div></div></blockquote><div class=""><br class=""></div>+1. Assuming there are no major objections, I don’t think this needs a full evolution cycle. This seems like a bug fix to me.</div><div style="font-family: Helvetica; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">-Chris<br class=""><div class=""><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><br class=""></div><div class="">Currently the following code is only compatible with 3.0-RELEASE, because RegularExpression on Linux becomes NSRegularExpression in 3.0.1, while we cannot use `#if` to differentiate between 3.0 and 3.0.1.</div><div class=""><br class=""></div><div class=""><span class="" style="font-family: Menlo; font-size: 11px; color: rgb(120, 73, 42); font-variant-ligatures: no-common-ligatures;"> #if</span><span class="" style="font-family: Menlo; font-size: 11px; font-variant-ligatures: no-common-ligatures;"> !</span><span class="" style="font-family: Menlo; font-size: 11px; color: rgb(120, 73, 42); font-variant-ligatures: no-common-ligatures;">os</span><span class="" style="font-family: Menlo; font-size: 11px; font-variant-ligatures: no-common-ligatures;">(</span><span class="" style="font-family: Menlo; font-size: 11px; color: rgb(120, 73, 42); font-variant-ligatures: no-common-ligatures;">macOS</span><span class="" style="font-family: Menlo; font-size: 11px; font-variant-ligatures: no-common-ligatures;">)</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures;"> </span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);">let</span><span class="" style="font-variant-ligatures: no-common-ligatures;"> regex = </span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);">try</span><span class="" style="font-variant-ligatures: no-common-ligatures;"> RegularExpression(pattern: pattern, options: [ .dotMatchesLineSeparators ])</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures;"> </span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(120, 73, 42);">#else</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures;"> </span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);">let</span><span class="" style="font-variant-ligatures: no-common-ligatures;"> regex = </span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);">try</span><span class="" style="font-variant-ligatures: no-common-ligatures;"> </span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);">NSRegularExpression</span><span class="" style="font-variant-ligatures: no-common-ligatures;">(pattern: pattern, options: [ .</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);">dotMatchesLineSeparators</span><span class="" style="font-variant-ligatures: no-common-ligatures;"> ])</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures;"> </span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(120, 73, 42);">#endif</span></div><div class=""><br class=""></div><div class=""><b class="">Proposed solution:</b></div><div class=""><b class=""><br class=""></b></div><div class="">If `#if swift(>=)` can take the third version component, we can make the code compatible with 3.0.1 by the following:</div><div class=""><br class=""></div><div class=""><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);"><span class="" style="font-variant-ligatures: no-common-ligatures;"> </span><span class="" style="color: rgb(120, 73, 42); font-variant-ligatures: no-common-ligatures;">#if</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span></span><span class="" style="color: rgb(120, 73, 42); font-variant-ligatures: no-common-ligatures;">os</span><span class="" style="font-variant-ligatures: no-common-ligatures;">(</span><span class="" style="color: rgb(120, 73, 42); font-variant-ligatures: no-common-ligatures;">macOS</span><span class="" style="font-variant-ligatures: no-common-ligatures;">) ||<span class="Apple-converted-space"> </span></span><span class="" style="color: rgb(120, 73, 42); font-variant-ligatures: no-common-ligatures;">swift</span><span class="" style="font-variant-ligatures: no-common-ligatures;">(>=</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(39, 42, 216);">3.0</span><span class="" style="font-variant-ligatures: no-common-ligatures;">.</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(39, 42, 216);">1</span><span class="" style="font-variant-ligatures: no-common-ligatures;">)</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);"><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);"> let</span><span class="" style="font-variant-ligatures: no-common-ligatures;"> regex = </span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);">try</span><span class="" style="font-variant-ligatures: no-common-ligatures;"> </span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);">NSRegularExpression</span><span class="" style="font-variant-ligatures: no-common-ligatures;">(pattern: pattern, options: [ .</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);">dotMatchesLineSeparators</span><span class="" style="font-variant-ligatures: no-common-ligatures;"> ])</span></span> </div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures;"> </span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(120, 73, 42);">#else</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(120, 73, 42);"><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);"> let</span><span class="" style="font-variant-ligatures: no-common-ligatures;"> regex = </span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);">try</span><span class="" style="font-variant-ligatures: no-common-ligatures;"> RegularExpression(pattern: pattern, options: [ .dotMatchesLineSeparators ])</span></span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures;"> </span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(120, 73, 42);">#endif</span></div></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(120, 73, 42);"><span class="" style="font-family: Helvetica; font-size: 12px;"><br class=""></span></span></div><div class="" style="margin: 0px; line-height: normal;">Additionally, we can consider supporting the == operator, so that checking only the version with inconsistent naming is sufficient:</div><div class="" style="margin: 0px; line-height: normal;"><br class=""></div><div class="" style="margin: 0px; line-height: normal;"><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(120, 73, 42);"><span class="" style="font-variant-ligatures: no-common-ligatures;"> #if</span><span class="" style="font-variant-ligatures: no-common-ligatures;"> !</span><span class="" style="font-variant-ligatures: no-common-ligatures;">os</span><span class="" style="font-variant-ligatures: no-common-ligatures;">(</span><span class="" style="font-variant-ligatures: no-common-ligatures;">macOS</span><span class="" style="font-variant-ligatures: no-common-ligatures;">) &&<span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures;">swift</span><span class="" style="font-variant-ligatures: no-common-ligatures;">(==</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(39, 42, 216);">3.0</span><span class="" style="font-variant-ligatures: no-common-ligatures;">.</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(39, 42, 216);">0</span><span class="" style="font-variant-ligatures: no-common-ligatures;">)</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures;"> <span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);">let</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span>regex =<span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);">try</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span>RegularExpression(pattern: pattern, options: [ .dotMatchesLineSeparators ])</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures;"> <span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(120, 73, 42);">#else</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures;"> <span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);">let</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span>regex =<span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);">try</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);">NSRegularExpression</span><span class="" style="font-variant-ligatures: no-common-ligatures;">(pattern: pattern, options: [ .</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);">dotMatchesLineSeparators</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span>])</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures;"> <span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(120, 73, 42);">#endif</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><br class=""></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><b class="" style="font-family: Helvetica; font-size: 12px;">Impact on existing code:</b></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><br class=""></div><div class="" style="margin: 0px; line-height: normal;">`#if swift(>=X.X.X)` and `#if swift(==X.X.X)` are purely additive.</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(120, 73, 42);"><br class=""></span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(120, 73, 42);"><span class="" style="font-family: Helvetica; font-size: 12px;">-Richard</span></span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(120, 73, 42);"><span class="" style="font-family: Helvetica; font-size: 12px;"><br class=""></span></span></div></div></div>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></div></blockquote></div><br class="" style="font-family: Helvetica; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="font-family: Helvetica; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">_______________________________________________</span><br style="font-family: Helvetica; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">swift-evolution mailing list</span><br style="font-family: Helvetica; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="mailto:swift-evolution@swift.org" style="font-family: Helvetica; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">swift-evolution@swift.org</a><br style="font-family: Helvetica; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" style="font-family: Helvetica; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></div></blockquote></div><br class=""></body></html>