<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">Am 21.12.2017 um 23:48 schrieb Andrew Bennett via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt;:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Can you go into more detail about why the core team didn't like this?<div class=""><pre style="box-sizing:border-box;font-family:SFMono-Regular,Consolas,&quot;Liberation Mono&quot;,Menlo,Courier,monospace;font-size:13.600000381469727px;margin-top:0px;margin-bottom:0px;word-wrap:normal;padding:16px;overflow:auto;line-height:1.45;background-color:rgb(246,248,250);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-break:normal;color:rgb(36,41,46)" class=""><span class="gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-k" style="box-sizing:border-box;color:rgb(215,58,73)">public</span> <span class="gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-k" style="box-sizing:border-box;color:rgb(215,58,73)">enum</span> <span class="gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-en" style="box-sizing:border-box;color:rgb(111,66,193)">HomeworkExcuse</span> {
  <span class="gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-k" style="box-sizing:border-box;color:rgb(215,58,73)">case</span> <span class="gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,92,197)">eatenByPet</span>
  <span class="gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-k" style="box-sizing:border-box;color:rgb(215,58,73)">case</span> <span class="gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,92,197)">thoughtItWasDueNextWeek</span>
  <span class="gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-k" style="box-sizing:border-box;color:rgb(215,58,73)">default</span> <span class="gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-c" style="box-sizing:border-box;color:rgb(106,115,125)"><span class="gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-c" style="box-sizing:border-box">//</span> NEW</span>
<span class="gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-c" style="box-sizing:border-box;color:rgb(106,115,125)"></span>}</pre></div><div class=""><div class=""><br class=""></div><div class="">To me this is very close to an ideal solution, it fixes ABI concerns, it has sensible defaults. If it was changed a little bit:</div><div class=""><br class=""></div><div class=""><pre style="box-sizing:border-box;font-family:SFMono-Regular,Consolas,&quot;Liberation Mono&quot;,Menlo,Courier,monospace;font-size:13.600000381469727px;margin-top:0px;margin-bottom:0px;word-wrap:normal;padding:16px;overflow:auto;line-height:1.45;background-color:rgb(246,248,250);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-break:normal" class=""><span class="gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-k" style="color:rgb(215,58,73);box-sizing:border-box">public</span><font color="#24292e" class=""> </font><span class="gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-k" style="color:rgb(215,58,73);box-sizing:border-box">enum</span><font color="#24292e" class=""> </font><span class="gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-en" style="color:rgb(111,66,193);box-sizing:border-box">HomeworkExcuse</span><font color="#24292e" class=""> {
  </font><span class="gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-k" style="color:rgb(215,58,73);box-sizing:border-box">case</span><font color="#24292e" class=""> </font><span class="gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-c1" style="box-sizing:border-box"><font color="#0b5394" class="">eatenByPet</font></span><font color="#24292e" class="">
  </font><span class="gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-k" style="color:rgb(215,58,73);box-sizing:border-box">case</span><font color="#24292e" class=""> </font><span class="gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-c1" style="box-sizing:border-box"><font color="#0b5394" class="">thoughtItWasDueNextWeek</font></span><font color="#24292e" class="">
  </font><span class="gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-k" style="color:rgb(215,58,73);box-sizing:border-box">fallback </span><span class="gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-k" style="box-sizing:border-box"><font color="#0b5394" class="">unknown</font></span><font color="#24292e" class=""> </font><span class="gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-c" style="color:rgb(106,115,125);box-sizing:border-box"><span class="gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-c" style="box-sizing:border-box">//</span> NEW</span><font color="#24292e" class="">
</font><span class="gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-c" style="box-sizing:border-box;color:rgb(106,115,125)"></span><font color="#24292e" class="">}</font></pre></div><div class=""><br class=""></div><div class="">Then I believe you would be able to have an exhaustive switch like this:</div><div class=""><br class=""></div><div class=""><pre style="box-sizing:border-box;font-family:SFMono-Regular,Consolas,&quot;Liberation Mono&quot;,Menlo,Courier,monospace;font-size:13.600000381469727px;margin-top:0px;margin-bottom:0px;word-wrap:normal;padding:16px;overflow:auto;line-height:1.45;background-color:rgb(246,248,250);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-break:normal" class=""><span class="gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-en" style="box-sizing:border-box"><font color="#d73a49" class="">switch </font></span><span class="gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-en" style="color:rgb(111,66,193);box-sizing:border-box">thing</span><font color="#24292e" class=""> {
  </font><span class="gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-k" style="color:rgb(215,58,73);box-sizing:border-box">case</span><font color="#24292e" class=""> </font><span class="gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-c1" style="box-sizing:border-box"><font color="#0b5394" class="">eatenByPet: </font><font color="#cc0000" class="">break</font></span><font color="#24292e" class="">
  </font><span class="gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-k" style="color:rgb(215,58,73);box-sizing:border-box">case</span><font color="#24292e" class=""> </font><span class="gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-c1" style="box-sizing:border-box"><font color="#0b5394" class="">thoughtItWasDueNextWeek:</font><font color="#cc0000" class=""> break</font></span><font color="#24292e" class="">
  </font><span class="gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-k" style="color:rgb(215,58,73);box-sizing:border-box">case </span><span class="gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-k" style="box-sizing:border-box"><font color="#0b5394" class="">unknown</font><font color="#24292e" class="">: </font><font color="#cc0000" class="">break</font></span><font color="#24292e" class="">
</font><span class="gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-c" style="box-sizing:border-box;color:rgb(106,115,125)"></span><font color="#24292e" class="">}</font></pre></div><div class=""><br class=""></div><div class="gmail_extra">Which would&nbsp;<b class="">still allow compile-time errors if new cases are introduced</b>, while providing a concise way to show something is not exhaustible.</div><div class="gmail_extra"><br class=""></div><div class="gmail_extra">This would also <b class="">support existing enums with "unknown" equivalent cases</b> would be able to explicitly label those fields as&nbsp;fallback without needing to make large code changes.</div><div class="gmail_extra"><br class=""></div><div class="gmail_extra">I see no reason why you shouldn't be able to use ".unknown", which <b class="">should still allow this to be testable</b>.</div></div></div></div></blockquote><div><br class=""></div>This is an extremely elegant solution which seems to solve all problems very nicely!!</div><div>Yes, instead of marking the enum as non-exhaustive let’s just add a placeholder case for future cases.</div><div>I’m very much in favor of this.</div><div><br class=""></div><div>-Thorsten</div><div><br class=""></div><div><br class=""></div><div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><div class="gmail_extra"><br class=""></div><div class="gmail_extra">Thanks,</div><div class="gmail_extra">Andrew</div></div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Tue, Oct 3, 2017 at 8:10 AM, Jordan Rose via swift-evolution <span dir="ltr" class="">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>&gt;</span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space" class=""><div class="">I don't think I have anything to say on this topic that I haven't already said:</div><div class=""><br class=""></div><div class="">- Switching exhaustively over non-exhaustive enums is uncommon.</div><div class="">- It's more important for a library to build without errors when its dependencies change than it is to get an error. (This doesn't apply to warnings, though.)</div><div class="">- Untestable code is dangerous, so having a language feature inherently for untestable code seems bad.</div><div class=""><br class=""></div><div class="">None of that negates your points; it just affects the weighting of whether or not 'future' or 'switch!' is worth it. However, I've added a link to your email in the proposal proper so that the Core Team and wider review audience have a chance to decide differently.</div><div class=""><br class=""></div><div class="">Jordan</div><div class=""><div class="h5"><br class=""><div class=""><br class=""><blockquote type="cite" class=""><div class="">On Oct 2, 2017, at 08:25, Vladimir.S via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="m_6449439514359007385Apple-interchange-newline"><div class=""><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important" class="">Sorry to bother, but I still can't understand how the proposed change *without* a 'future' case in switch will change our life and what would be our steps to support our code and to not make our code buggy.</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important" class="">If I misunderstand something - sorry, please point me on this and I hope this also help some one like me to understand the subject better.</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important" class="">For example. I use OAuth2 framework, built by Carthage. Did add the OAuth2.framework to my project.</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important" class="">Currently OAuth2 exports 'public enum OAuth2Error'. I do have a place in my code where I switch on each case of such error instance to do my best with error: generate detailed description for user, other additional steps depending on error.</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important" class="">Will/should author of OAuth2 make OAuth2Error 'exhaustive' ? No.</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important" class="">Will new cases be added to that enum in future: Most likely Yes.</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important" class="">Do I need to switch on each case in my code? Yes.</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important" class="">Can I currently rely on compiler to keep my error processing in sync with error cases defined in framework? Yes.</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important" class="">Can new cases appear in *run-time* of my app: NO, framework in embedded.</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important" class="">Will I be able to rely on compiler after the proposed change? No?!</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important" class="">What should I do to keep my switch in sync with OAuth2Error cases after each update of OAuth2 library(framework)? Manually check if new cases are added?! Configure lint/other tools to help me with this?!</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important" class="">What I, as a developer, as a consumer of framework, need - is a way to exhaustively switch on *some* external non-exhaustive enums *at the moment of compilation*. And we can accomplish this only(AFAICT) with 'future' case in 'switch'.</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important" class="">In case we'll have 'future' case my life will not be *worse* for this project : I'll add it to my switch and still can receive help from compiler to keep switch exhaustive.</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important" class="">I don't support the opinion that we can't introduce 'future' case because of we can't test it:</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important" class="">1. Not being able to keep my switch exhaustive when I need this, and so not being able to provide users of my app with best experience - IMO is worse.</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important" class="">2. In my particular example, 'future' case will be *never* called, if I understand correctly.</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important" class="">3. If switch on non-exhaustive enum is exhaustive by fact, we can't test the 'default' branch also. So, 'future' is in same position here with 'default'</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important" class="">4. I believe if we'll decide we need 'future' case - we can suggest a way to call code in that case during the test process.</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important" class="">Seems like for embedded frameworks we should apply the same rules(regarding enums) as for sources, as we compile the app with concrete binary of framework and there just can't be new cases in enums. No?</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important" class="">Thank you for your time.</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important" class="">Vladimir.</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important" class="">On 01.10.2017 3:00, Slava Pestov via swift-evolution wrote:</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><blockquote type="cite" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><blockquote type="cite" class="">On Sep 30, 2017, at 4:46 PM, Karl Wagner via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a> &lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">mailto:swift-evolution@swift.<wbr class="">org</a>&gt;&gt; wrote:<br class=""><br class="">I don’t see how it’s impractical. Quite a lot about how the library should be optimally compiled and used depends on what you plan to do with it. If it’s going to be installed somewhere private and you can guarantee clients will always have the latest version, you can assume all data types are final, @_fixed_layout, @exhaustive, whatever (essentially in-module). An example of that would be a library embedded inside an iOS app bundle. If it’s going to be installed somewhere public and expose some API (like Apple’s frameworks), then you’re going to have to think about binary compatibility.<br class=""><br class="">That also means that in-app libraries are optimised as much as they can be, and that resilience-related changes on the declaration side can be limited to the limited set of Swift developers who truly have to care about that.<br class=""></blockquote>We do plan on exposing an -enable-resilience flag which basically does what you describe. When a library is built without -enable-resilience, all types are assumed to be fixed layout, etc. However, we don’t want language flags to change language semantics, so exhaustive/nonexhaustive still make sense even when building without resilience, I think. When you switch over a non-exhaustive enum that came from a library built without -enable-resilience, the compiler can still use the most efficient possible access pattern and assume that no new cases will be introduced, but the type checker would still require a default case to be present. The optimizer can then basically strip out the default case as dead code.<br class="">Slava<br class=""><blockquote type="cite" class=""><br class="">- Karl<br class=""></blockquote>______________________________<wbr class="">_________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank" class="">https://lists.swift.org/<wbr class="">mailman/listinfo/swift-<wbr class="">evolution</a><br class=""></blockquote><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important" class="">______________________________<wbr class="">_________________</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important" class="">swift-evolution mailing list</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><a href="mailto:swift-evolution@swift.org" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank" class="">swift-evolution@swift.org</a><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank" class="">https://lists.swift.org/<wbr class="">mailman/listinfo/swift-<wbr class="">evolution</a></div></blockquote></div><br class=""></div></div></div><br class="">______________________________<wbr class="">_________________<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" rel="noreferrer" target="_blank" class="">https://lists.swift.org/<wbr class="">mailman/listinfo/swift-<wbr class="">evolution</a><br class="">
<br class=""></blockquote></div><br class=""></div>
_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></body></html>