<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="">On Jan 10, 2018, at 12:04, Jose Cheyo Jimenez via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><br class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Tue, Jan 9, 2018 at 10:10 PM, Chris Lattner <span dir="ltr" class="">&lt;<a href="mailto:clattner@nondot.org" target="_blank" class="">clattner@nondot.org</a>&gt;</span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-">On Jan 9, 2018, at 3:07 PM, Jose Cheyo Jimenez &lt;<a href="mailto:cheyo@masters3d.com" class="">cheyo@masters3d.com</a>&gt; wrote:<br class="">
&gt; Hi Chris,<br class="">
&gt;<br class="">
&gt; This is great. Thanks for spending time on this! I am in favor of `case #unknown` to only match unknown cases.<br class="">
&gt;<br class="">
&gt; 1) Would #uknown be available to RawRepresentable structs?<br class="">
<br class="">
</span>I haven’t considered this, so I’m not sure how that would work.&nbsp; I had assumed that this would be an enum specific concept.<br class="">
<br class="">
What do you have in mind?&nbsp; If your raw representation is itself an enum, then of course this would work.<br class=""></blockquote><div class=""><br class=""></div><div class="">I was just curious since a RawRepresentable structs ( and OptionSet ) are very similar to non exhaustive enums in that they would require handling unknown cases. Currently RawRepresentable&nbsp;is required to use a default even if all cases are accounted for.&nbsp;</div><div class=""><br class=""></div><div class=""><div class="">struct Directions: OptionSet {</div><div class="">&nbsp; &nbsp; let rawValue: UInt8</div><div class="">&nbsp; &nbsp; static let up&nbsp; &nbsp; = Directions(rawValue: 1 &lt;&lt; 0)</div><div class="">}</div><div class=""><br class=""></div><div class="">let myDir = Directions.up</div><div class=""><br class=""></div><div class="">switch myDir</div><div class="">{</div><div class="">&nbsp; &nbsp; case .up : print("matched")</div><div class="">&nbsp; &nbsp; default: print("default required")&nbsp;</div><div class="">}</div></div></div></div></div></div></blockquote><br class=""></div><div>Since an option set has 2^N possible values, not just N, we don't expect anyone to be switching over them! And it wouldn't be correct to try to do so exhaustively anyway.</div><div><br class=""></div><div>Jordan</div><br class=""></body></html>