<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=""><br class=""><div><blockquote type="cite" class=""><div class="">On Sep 28, 2017, at 4:15 PM, Goffredo Marocchi 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=""><meta http-equiv="content-type" content="text/html; charset=utf-8" class=""><div dir="auto" class="">Agreed, I am not seeing this change doing so much good because maybe it could prevent issues Library writers or developers updating libraries without checking things... not trying to be rude and/or non empathetic, but exhaustive enums never struck me as a bad thing and the reasons why they could be bad very quickly leads one to think “maybe you should not have been switching on enums there...”.</div></div></blockquote><br class=""></div><div>You're suggesting that we use enums when something is known to be exhaustive, and then something like this when it's not?</div><div><br class=""></div><div style="margin: 0px; font-size: 18px; line-height: normal; font-family: 'SF Compact Display'; color: rgb(164, 176, 177); background-color: rgb(0, 57, 70);" class=""><span style="color: #de5194" class="">struct</span> SomeOptionSetOrWhatever : <span style="color: #7f87cf" class="">Equatable</span>, <span style="color: #7f87cf" class="">RawRepresentable</span> {</div><div style="margin: 0px; font-size: 18px; line-height: normal; font-family: 'SF Compact Display'; color: rgb(127, 135, 207); background-color: rgb(0, 57, 70);" class=""><span style="color: #a4b0b1" class=""><span class="Apple-tab-span" style="white-space:pre">        </span></span><span style="color: #de5194" class="">public</span><span style="color: #a4b0b1" class=""> </span><span style="color: #de5194" class="">static</span><span style="color: #a4b0b1" class=""> </span><span style="color: #de5194" class="">func</span><span style="color: #a4b0b1" class=""> == (lhs: </span>SomeOptionSetOrWhatever<span style="color: #a4b0b1" class="">, rhs: </span>SomeOptionSetOrWhatever<span style="color: #a4b0b1" class="">) -> </span>Bool<span style="color: #a4b0b1" class=""> { </span><span style="color: #de5194" class="">return</span><span style="color: #a4b0b1" class=""> lhs.</span><span style="color: #2fafa9" class="">value</span><span style="color: #a4b0b1" class=""> == rhs.</span><span style="color: #2fafa9" class="">value</span><span style="color: #a4b0b1" class=""> <span class="Apple-tab-span" style="white-space:pre">        </span>}</span></div><div style="margin: 0px; font-size: 18px; line-height: normal; font-family: 'SF Compact Display'; color: rgb(164, 176, 177); background-color: rgb(0, 57, 70);" class=""><span class="Apple-tab-span" style="white-space:pre">        </span><span style="color: #de5194" class="">public</span> <span style="color: #de5194" class="">static</span> <span style="color: #de5194" class="">let</span> optionOne = <span style="color: #7f87cf" class="">SomeOptionSetOrWhatever</span>(privateInit: <span style="color: #e5493d" class="">1</span>)</div><div style="margin: 0px; font-size: 18px; line-height: normal; font-family: 'SF Compact Display'; color: rgb(164, 176, 177); background-color: rgb(0, 57, 70);" class=""><span class="Apple-tab-span" style="white-space:pre">        </span><span style="color: #de5194" class="">public</span> <span style="color: #de5194" class="">static</span> <span style="color: #de5194" class="">let</span> optionTwo = <span style="color: #7f87cf" class="">SomeOptionSetOrWhatever</span>(privateInit: <span style="color: #e5493d" class="">2</span>)</div><div style="margin: 0px; font-size: 18px; line-height: normal; font-family: 'SF Compact Display'; color: rgb(222, 81, 148); background-color: rgb(0, 57, 70);" class=""><span style="color: #a4b0b1" class=""><span class="Apple-tab-span" style="white-space:pre">        </span></span>private<span style="color: #a4b0b1" class=""> </span>let<span style="color: #a4b0b1" class=""> value: </span><span style="color: #7f87cf" class="">Int</span></div><div style="margin: 0px; font-size: 18px; line-height: normal; font-family: 'SF Compact Display'; color: rgb(164, 176, 177); background-color: rgb(0, 57, 70);" class=""><span class="Apple-tab-span" style="white-space:pre">        </span><span style="color: #de5194" class="">private</span> <span style="color: #de5194" class="">init</span>(privateInit value: <span style="color: #7f87cf" class="">Int</span>) { <span style="color: #de5194" class="">self</span>.<span style="color: #2fafa9" class="">value</span> = value }</div><div style="margin: 0px; font-size: 18px; line-height: normal; font-family: 'SF Compact Display'; color: rgb(164, 176, 177); background-color: rgb(0, 57, 70);" class=""><span class="Apple-tab-span" style="white-space:pre">        </span><span style="color: #de5194" class="">public</span> <span style="color: #de5194" class="">init</span>?(rawValue: <span style="color: #7f87cf" class="">Int</span>) {</div><div style="margin: 0px; font-size: 18px; line-height: normal; font-family: 'SF Compact Display'; color: rgb(164, 176, 177); background-color: rgb(0, 57, 70);" class=""><span class="Apple-tab-span" style="white-space:pre">                </span><span style="color: #de5194" class="">switch</span> rawValue {</div><div style="margin: 0px; font-size: 18px; line-height: normal; font-family: 'SF Compact Display'; color: rgb(164, 176, 177); background-color: rgb(0, 57, 70);" class=""><span class="Apple-tab-span" style="white-space:pre">                </span><span style="color: #de5194" class="">case</span> <span style="color: #e5493d" class="">1</span>: <span style="color: #de5194" class="">self</span> = .<span style="color: #2fafa9" class="">optionOne</span></div><div style="margin: 0px; font-size: 18px; line-height: normal; font-family: 'SF Compact Display'; color: rgb(164, 176, 177); background-color: rgb(0, 57, 70);" class=""><span class="Apple-tab-span" style="white-space:pre">                </span><span style="color: #de5194" class="">case</span> <span style="color: #e5493d" class="">2</span>: <span style="color: #de5194" class="">self</span> = .<span style="color: #2fafa9" class="">optionTwo</span></div><div style="margin: 0px; font-size: 18px; line-height: normal; font-family: 'SF Compact Display'; color: rgb(222, 81, 148); background-color: rgb(0, 57, 70);" class=""><span style="color: #a4b0b1" class=""><span class="Apple-tab-span" style="white-space:pre">                </span></span>case<span style="color: #a4b0b1" class=""> </span>_<span style="color: #a4b0b1" class="">: </span><span style="color: #2fafa9" class="">value</span><span style="color: #a4b0b1" class=""> = </span><span style="color: #e5493d" class="">0</span><span style="color: #a4b0b1" class="">; </span>return<span style="color: #a4b0b1" class=""> </span>nil</div><div style="margin: 0px; font-size: 18px; line-height: normal; font-family: 'SF Compact Display'; color: rgb(164, 176, 177); background-color: rgb(0, 57, 70);" class=""><span class="Apple-tab-span" style="white-space:pre">                </span>}</div><div style="margin: 0px; font-size: 18px; line-height: normal; font-family: 'SF Compact Display'; color: rgb(164, 176, 177); background-color: rgb(0, 57, 70);" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><div style="margin: 0px; font-size: 18px; line-height: normal; font-family: 'SF Compact Display'; color: rgb(164, 176, 177); background-color: rgb(0, 57, 70);" class=""><span class="Apple-tab-span" style="white-space:pre">        </span><span style="color: #de5194" class="">public</span> <span style="color: #de5194" class="">var</span> rawValue: <span style="color: #7f87cf" class="">Int</span> { <span style="color: #de5194" class="">return</span> <span style="color: #2fafa9" class="">value</span><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><div style="margin: 0px; font-size: 18px; line-height: normal; font-family: 'SF Compact Display'; color: rgb(164, 176, 177); background-color: rgb(0, 57, 70);" class="">}</div><div style="margin: 0px; line-height: normal; background-color: rgb(0, 57, 70); min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; font-size: 18px; line-height: normal; font-family: 'SF Compact Display'; color: rgb(127, 135, 207); background-color: rgb(0, 57, 70);" class=""><span style="color: #de5194" class="">func</span><span style="color: #a4b0b1" class=""> foo(x: </span>SomeOptionSetOrWhatever<span style="color: #a4b0b1" class="">) {</span></div><div style="margin: 0px; font-size: 18px; line-height: normal; font-family: 'SF Compact Display'; color: rgb(222, 81, 148); background-color: rgb(0, 57, 70);" class=""><span style="color: #a4b0b1" class=""><span class="Apple-tab-span" style="white-space:pre">        </span></span>switch<span style="color: #a4b0b1" class=""> x {</span></div><div style="margin: 0px; font-size: 18px; line-height: normal; font-family: 'SF Compact Display'; color: rgb(215, 96, 27); background-color: rgb(0, 57, 70);" class=""><span style="color: #a4b0b1" class=""><span class="Apple-tab-span" style="white-space:pre">        </span></span><span style="color: #de5194" class="">case</span><span style="color: #a4b0b1" class=""> .</span><span style="color: #2fafa9" class="">optionOne</span><span style="color: #a4b0b1" class="">: </span><span style="color: #2c9edb" class="">print</span><span style="color: #a4b0b1" class="">(</span>"first option"<span style="color: #a4b0b1" class="">)</span></div><div style="margin: 0px; font-size: 18px; line-height: normal; font-family: 'SF Compact Display'; color: rgb(215, 96, 27); background-color: rgb(0, 57, 70);" class=""><span style="color: #a4b0b1" class=""><span class="Apple-tab-span" style="white-space:pre">        </span></span><span style="color: #de5194" class="">case</span><span style="color: #a4b0b1" class=""> .</span><span style="color: #2fafa9" class="">optionTwo</span><span style="color: #a4b0b1" class="">: </span><span style="color: #2c9edb" class="">print</span><span style="color: #a4b0b1" class="">(</span>"second option"<span style="color: #a4b0b1" class="">)</span></div><div style="margin: 0px; font-size: 18px; line-height: normal; font-family: 'SF Compact Display'; color: rgb(106, 129, 136); background-color: rgb(0, 57, 70);" class=""><span style="color: #a4b0b1" class=""><span class="Apple-tab-span" style="white-space:pre">        </span></span><span style="color: #de5194" class="">default</span><span style="color: #a4b0b1" class="">: </span><span style="color: #de5194" class="">break</span><span style="color: #a4b0b1" class=""> </span>//without this line, it's a "switch much be exhaustive" error</div><div style="margin: 0px; font-size: 18px; line-height: normal; font-family: 'SF Compact Display'; color: rgb(164, 176, 177); background-color: rgb(0, 57, 70);" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><div style="margin: 0px; font-size: 18px; line-height: normal; font-family: 'SF Compact Display'; color: rgb(164, 176, 177); background-color: rgb(0, 57, 70);" class="">}</div><div class=""><br class=""></div><div class="">- Dave Sweeris</div></body></html>