<div dir="ltr">Actually this make much more sense than original proposal.<div><br></div><div>Good call!</div><div><br></div><div>Just to check... </div><div><br></div><div>Its not better this?</div><div><br></div><div><pre style="box-sizing:border-box;font-family:SFMono-Regular,Consolas,&quot;Liberation Mono&quot;,Menlo,Courier,monospace;font-size:13.6px;margin-top:0px;margin-bottom:0px;word-wrap:normal;padding:16px;overflow:auto;line-height:1.45;background-color:rgb(246,248,250);border-radius:3px;word-break:normal;color:rgb(36,41,46)"><span class="inbox-inbox-m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-k" style="box-sizing:border-box;color:rgb(215,58,73)">public</span> <span class="inbox-inbox-m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-k" style="box-sizing:border-box;color:rgb(215,58,73)">enum</span> <span class="inbox-inbox-m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-en" style="box-sizing:border-box;color:rgb(111,66,193)">HomeworkExcuse</span> {
  <span class="inbox-inbox-m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-k" style="box-sizing:border-box;color:rgb(215,58,73)">case</span> <span class="inbox-inbox-m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,92,197)">eatenByPet</span>
  <span class="inbox-inbox-m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-k" style="box-sizing:border-box;color:rgb(215,58,73)">default case<span style="font-size:13.6px;color:rgb(36,41,46)"> </span><span class="inbox-inbox-inbox-inbox-m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-c1" style="font-size:13.6px;box-sizing:border-box;color:rgb(0,92,197)">thoughtItWasDueNextWeek</span></span>
<span class="inbox-inbox-m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-c" style="box-sizing:border-box;color:rgb(106,115,125)"></span>}</pre></div><div><br></div><div>If i understood correctly, if the enum is not exhaustible, must be considered as this default value after a new case be introduced in a new version of the lib right?<br></div><div><br></div><div>And for this one:</div><div><br></div><div><pre style="box-sizing:border-box;font-family:SFMono-Regular,Consolas,&quot;Liberation Mono&quot;,Menlo,Courier,monospace;font-size:13.6px;margin-top:0px;margin-bottom:0px;word-wrap:normal;padding:16px;overflow:auto;line-height:1.45;background-color:rgb(246,248,250);border-radius:3px;word-break:normal"><span class="inbox-inbox-m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-k" style="color:rgb(215,58,73);box-sizing:border-box">public</span><font color="#24292e"> </font><span class="inbox-inbox-m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-k" style="color:rgb(215,58,73);box-sizing:border-box">enum</span><font color="#24292e"> </font><span class="inbox-inbox-m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-en" style="color:rgb(111,66,193);box-sizing:border-box">HomeworkExcuse</span><font color="#24292e"> {
  </font><span class="inbox-inbox-m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-k" style="color:rgb(215,58,73);box-sizing:border-box">case</span><font color="#24292e"> </font><span class="inbox-inbox-m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-c1" style="box-sizing:border-box"><font color="#0b5394">eatenByPet</font></span><font color="#24292e">
  </font><span class="inbox-inbox-m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-k" style="color:rgb(215,58,73);box-sizing:border-box">case</span><font color="#24292e"> </font><span class="inbox-inbox-m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-c1" style="box-sizing:border-box"><font color="#0b5394">thoughtItWasDueNextWeek</font></span><font color="#24292e">
  </font><span class="inbox-inbox-m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-k" style="color:rgb(215,58,73);box-sizing:border-box">fallback </span><span class="inbox-inbox-m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-k" style="box-sizing:border-box"><font color="#0b5394">unknown</font></span><font color="#24292e"> </font><span class="inbox-inbox-m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-c" style="color:rgb(106,115,125);box-sizing:border-box"><span class="inbox-inbox-m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-c" style="box-sizing:border-box">//</span> any word of course right?</span><font color="#24292e">
</font><span class="inbox-inbox-m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-c" style="box-sizing:border-box;color:rgb(106,115,125)"></span><font color="#24292e">}</font></pre></div><div><br></div><div>In this case fallback is the same as default right? But has as explicit new label/case? </div><div><br></div><div>So, this is not enough?</div><div><br></div><div><pre style="box-sizing:border-box;font-family:SFMono-Regular,Consolas,&quot;Liberation Mono&quot;,Menlo,Courier,monospace;font-size:13.6px;margin-top:0px;margin-bottom:0px;word-wrap:normal;padding:16px;overflow:auto;line-height:1.45;background-color:rgb(246,248,250);border-radius:3px;word-break:normal;color:rgb(36,41,46)"><span class="inbox-inbox-inbox-inbox-m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-k" style="box-sizing:border-box;color:rgb(215,58,73)">public</span> <span class="inbox-inbox-inbox-inbox-m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-k" style="box-sizing:border-box;color:rgb(215,58,73)">enum</span> <span class="inbox-inbox-inbox-inbox-m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-en" style="box-sizing:border-box;color:rgb(111,66,193)">HomeworkExcuse</span> {
  <span class="inbox-inbox-inbox-inbox-m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-k" style="box-sizing:border-box;color:rgb(215,58,73)">case</span> <span class="inbox-inbox-inbox-inbox-m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,92,197)">eatenByPet</span>
  <span class="inbox-inbox-inbox-inbox-m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-k" style="box-sizing:border-box;color:rgb(215,58,73)">fallback case<span style="font-size:13.6px;color:rgb(36,41,46)"> </span><span class="inbox-inbox-inbox-inbox-inbox-inbox-m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-c1" style="font-size:13.6px;box-sizing:border-box;color:rgb(0,92,197)">thoughtItWasDueNextWeek</span></span>
<span class="inbox-inbox-inbox-inbox-m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-c" style="box-sizing:border-box;color:rgb(106,115,125)"></span>}</pre></div><div><br></div><div>If the dev wants to do make a default/fallback just use them for a regular case, if not, if he wants to make a totally different case for a fallback just declare another one to be the default/fallback (like unknown).</div><div><br></div><div>I understood your idea correctly?<br></div><div><br><div class="gmail_quote"><div dir="ltr">Em qui, 21 de dez de 2017 às 20:48, Andrew Bennett via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>&gt; escreveu:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Can you go into more detail about why the core team didn&#39;t like this?<div><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)"><span class="m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-k" style="box-sizing:border-box;color:rgb(215,58,73)">public</span> <span class="m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-k" style="box-sizing:border-box;color:rgb(215,58,73)">enum</span> <span class="m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-en" style="box-sizing:border-box;color:rgb(111,66,193)">HomeworkExcuse</span> {
  <span class="m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-k" style="box-sizing:border-box;color:rgb(215,58,73)">case</span> <span class="m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,92,197)">eatenByPet</span>
  <span class="m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-k" style="box-sizing:border-box;color:rgb(215,58,73)">case</span> <span class="m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,92,197)">thoughtItWasDueNextWeek</span>
  <span class="m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-k" style="box-sizing:border-box;color:rgb(215,58,73)">default</span> <span class="m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-c" style="box-sizing:border-box;color:rgb(106,115,125)"><span class="m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-c" style="box-sizing:border-box">//</span> NEW</span>
<span class="m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-c" style="box-sizing:border-box;color:rgb(106,115,125)"></span>}</pre></div><div><div><br></div><div>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><br></div><div><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"><span class="m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-k" style="color:rgb(215,58,73);box-sizing:border-box">public</span><font color="#24292e"> </font><span class="m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-k" style="color:rgb(215,58,73);box-sizing:border-box">enum</span><font color="#24292e"> </font><span class="m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-en" style="color:rgb(111,66,193);box-sizing:border-box">HomeworkExcuse</span><font color="#24292e"> {
  </font><span class="m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-k" style="color:rgb(215,58,73);box-sizing:border-box">case</span><font color="#24292e"> </font><span class="m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-c1" style="box-sizing:border-box"><font color="#0b5394">eatenByPet</font></span><font color="#24292e">
  </font><span class="m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-k" style="color:rgb(215,58,73);box-sizing:border-box">case</span><font color="#24292e"> </font><span class="m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-c1" style="box-sizing:border-box"><font color="#0b5394">thoughtItWasDueNextWeek</font></span><font color="#24292e">
  </font><span class="m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-k" style="color:rgb(215,58,73);box-sizing:border-box">fallback </span><span class="m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-k" style="box-sizing:border-box"><font color="#0b5394">unknown</font></span><font color="#24292e"> </font><span class="m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-c" style="color:rgb(106,115,125);box-sizing:border-box"><span class="m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-c" style="box-sizing:border-box">//</span> NEW</span><font color="#24292e">
</font><span class="m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-c" style="box-sizing:border-box;color:rgb(106,115,125)"></span><font color="#24292e">}</font></pre></div><div><br></div><div>Then I believe you would be able to have an exhaustive switch like this:</div><div><br></div><div><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"><span class="m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-en" style="box-sizing:border-box"><font color="#d73a49">switch </font></span><span class="m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-en" style="color:rgb(111,66,193);box-sizing:border-box">thing</span><font color="#24292e"> {
  </font><span class="m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-k" style="color:rgb(215,58,73);box-sizing:border-box">case</span><font color="#24292e"> </font><span class="m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-c1" style="box-sizing:border-box"><font color="#0b5394">eatenByPet: </font><font color="#cc0000">break</font></span><font color="#24292e">
  </font><span class="m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-k" style="color:rgb(215,58,73);box-sizing:border-box">case</span><font color="#24292e"> </font><span class="m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-c1" style="box-sizing:border-box"><font color="#0b5394">thoughtItWasDueNextWeek:</font><font color="#cc0000"> break</font></span><font color="#24292e">
  </font><span class="m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-k" style="color:rgb(215,58,73);box-sizing:border-box">case </span><span class="m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-k" style="box-sizing:border-box"><font color="#0b5394">unknown</font><font color="#24292e">: </font><font color="#cc0000">break</font></span><font color="#24292e">
</font><span class="m_-5878666511919927094gmail-m_1118565368265080773gmail-m_-1318432576890994713gmail-pl-c" style="box-sizing:border-box;color:rgb(106,115,125)"></span><font color="#24292e">}</font></pre></div><div><br></div><div class="gmail_extra">Which would <b>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></div><div class="gmail_extra">This would also <b>support existing enums with &quot;unknown&quot; equivalent cases</b> would be able to explicitly label those fields as fallback without needing to make large code changes.</div><div class="gmail_extra"><br></div><div class="gmail_extra">I see no reason why you shouldn&#39;t be able to use &quot;.unknown&quot;, which <b>should still allow this to be testable</b>.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Thanks,</div><div class="gmail_extra">Andrew</div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 3, 2017 at 8:10 AM, Jordan Rose via swift-evolution <span dir="ltr">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;</span> wrote:<br><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"><div>I don&#39;t think I have anything to say on this topic that I haven&#39;t already said:</div><div><br></div><div>- Switching exhaustively over non-exhaustive enums is uncommon.</div><div>- It&#39;s more important for a library to build without errors when its dependencies change than it is to get an error. (This doesn&#39;t apply to warnings, though.)</div><div>- Untestable code is dangerous, so having a language feature inherently for untestable code seems bad.</div><div><br></div><div>None of that negates your points; it just affects the weighting of whether or not &#39;future&#39; or &#39;switch!&#39; is worth it. However, I&#39;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><br></div><div>Jordan</div><div><div class="m_-5878666511919927094h5"><br><div><br><blockquote type="cite"><div>On Oct 2, 2017, at 08:25, Vladimir.S via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:</div><br class="m_-5878666511919927094m_6449439514359007385Apple-interchange-newline"><div><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"><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">Sorry to bother, but I still can&#39;t understand how the proposed change *without* a &#39;future&#39; 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"><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">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"><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"><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">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"><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"><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">Currently OAuth2 exports &#39;public enum OAuth2Error&#39;. 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"><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"><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">Will/should author of OAuth2 make OAuth2Error &#39;exhaustive&#39; ? 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"><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">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"><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">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"><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">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"><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">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"><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">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"><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">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"><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"><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">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 &#39;future&#39; case in &#39;switch&#39;.</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"><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">In case we&#39;ll have &#39;future&#39; case my life will not be *worse* for this project : I&#39;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"><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"><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">I don&#39;t support the opinion that we can&#39;t introduce &#39;future&#39; case because of we can&#39;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"><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"><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">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"><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">2. In my particular example, &#39;future&#39; 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"><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">3. If switch on non-exhaustive enum is exhaustive by fact, we can&#39;t test the &#39;default&#39; branch also. So, &#39;future&#39; is in same position here with &#39;default&#39;</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"><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">4. I believe if we&#39;ll decide we need &#39;future&#39; 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"><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"><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">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&#39;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"><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"><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">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"><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">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"><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"><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">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"><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"><blockquote type="cite">On Sep 30, 2017, at 4:46 PM, Karl Wagner via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a> &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">mailto:swift-evolution@swift.org</a>&gt;&gt; wrote:<br><br>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><br>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></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>Slava<br><blockquote type="cite"><br>- Karl<br></blockquote>_______________________________________________<br>swift-evolution mailing list<br><a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br></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">_______________________________________________</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"><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">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"><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">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"><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">https://lists.swift.org/mailman/listinfo/swift-evolution</a></div></blockquote></div><br></div></div></div><br>_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
<br></blockquote></div><br></div>
_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
</blockquote></div></div></div>