<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 <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> 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=""><<a href="mailto:clattner@nondot.org" target="_blank" class="">clattner@nondot.org</a>></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 <<a href="mailto:cheyo@masters3d.com" class="">cheyo@masters3d.com</a>> wrote:<br class="">
> Hi Chris,<br class="">
><br class="">
> This is great. Thanks for spending time on this! I am in favor of `case #unknown` to only match unknown cases.<br class="">
><br class="">
> 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. I had assumed that this would be an enum specific concept.<br class="">
<br class="">
What do you have in mind? 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 is required to use a default even if all cases are accounted for. </div><div class=""><br class=""></div><div class=""><div class="">struct Directions: OptionSet {</div><div class=""> let rawValue: UInt8</div><div class=""> static let up = Directions(rawValue: 1 << 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=""> case .up : print("matched")</div><div class=""> default: print("default required") </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>