<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="">Thanks for the clarification. &nbsp;Why is the compiler saying that the catch is not exhaustive when it is covering all the possible values of the enum? &nbsp;Is it to be able to catch future values added to the enum type?<div class=""><br class=""></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Dec 18, 2015, at 8:05 PM, David Owens II &lt;<a href="mailto:david@owensd.io" class="">david@owensd.io</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Dec 18, 2015, at 4:38 PM, Ricardo Parada &lt;<a href="mailto:rparada@mac.com" class="">rparada@mac.com</a>&gt; 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=""><div class=""><div class=""><span style="background-color: rgba(255, 255, 255, 0);" class="">Hi David</span></div><div class=""><span style="background-color: rgba(255, 255, 255, 0);" class=""><br class=""></span></div><div class=""><span style="background-color: rgba(255, 255, 255, 0);" class="">I started reading your proposal and I have a couple of questions.&nbsp;</span></div><div class=""><span style="background-color: rgba(255, 255, 255, 0);" class=""><br class=""></span></div><div class=""><span style="background-color: rgba(255, 255, 255, 0);" class="">In the Enum Base ErrorType example you mentioned that it requires a "catch { }" clause. &nbsp;However the code is already covering the two possible Enum values (OffBy1 and MutatedValue). Why is the "catch { }" required? I typed that code into a playground and I did not get any errors. Are you saying that because the Enum type could add a value in the future?</span></div></div></div></div></blockquote><div class=""><br class=""></div><div class="">Playgrounds are basically in an anonymous function that throws, so the problem doesn’t show up there at the top level. Copy this into your playground.</div><div class=""><br class=""></div></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class=""><div class=""><font face="Menlo" class="">enum&nbsp;MyError:&nbsp;ErrorType&nbsp;{</font></div></div><div class=""><div class=""><font face="Menlo" class="">&nbsp; &nbsp;&nbsp;case&nbsp;OnlyOne</font></div></div><div class=""><div class=""><font face="Menlo" class="">}</font></div></div><div class=""><div class=""><font face="Menlo" class=""><br class=""></font></div></div><div class=""><div class=""><font face="Menlo" class="">func&nbsp;thrower()&nbsp;throws&nbsp;{&nbsp;throw&nbsp;MyError.OnlyOne&nbsp;}</font></div></div><div class=""><div class=""><font face="Menlo" class=""><br class=""></font></div></div><div class=""><div class=""><font face="Menlo" class="">func&nbsp;nolies() {</font></div></div><div class=""><div class=""><font face="Menlo" class="">&nbsp; &nbsp;&nbsp;do&nbsp;{</font></div></div><div class=""><div class=""><font face="Menlo" class="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;try&nbsp;thrower()</font></div></div><div class=""><div class=""><font face="Menlo" class="">&nbsp; &nbsp;&nbsp;}</font></div></div><div class=""><div class=""><font face="Menlo" class="">&nbsp; &nbsp;&nbsp;catch&nbsp;MyError.OnlyOne {&nbsp;print("handled") }</font></div></div><div class=""><div class=""><font face="Menlo" class="">&nbsp; &nbsp; //&nbsp;catch&nbsp;{&nbsp;print("compiler error until uncommented") }</font></div></div><div class=""><div class=""><font face="Menlo" class="">}</font></div></div></blockquote><div class=""><div class=""><br class=""></div><blockquote type="cite" class=""><div dir="auto" class=""><div class=""><div class=""><span style="background-color: rgba(255, 255, 255, 0);" class="">Also, you proposed the catch clause to use error as the name of the constant holding the error. &nbsp;Wouldn't it be better to let the programmer decide the name rather than hard coding it to use error? For example:</span></div><div class=""><span style="background-color: rgba(255, 255, 255, 0);" class=""><br class=""></span></div><div class=""><span style="background-color: rgba(255, 255, 255, 0);" class="">catch e where e.value == 0 { print("0") }</span></div><div class=""><div class=""><span style="background-color: rgba(255, 255, 255, 0);" class="">catch e where e.value == 1 { print("1") }</span></div><div class=""><span style="background-color: rgba(255, 255, 255, 0);" class="">catch { print("nothing") }</span></div></div></div></div></blockquote><div class=""><br class=""></div><div class="">The “error” name is already specified in the Swift rules for what the constant is. I don’t see any compelling reason to propose a change to that.</div><div class=""><br class=""></div><div class="">-David</div></div></div></div></blockquote></div><br class=""></div></body></html>