[swift-evolution] Handling unknown cases in enums [RE: SE-0192]

Chris Lattner clattner at nondot.org
Wed Jan 10 00:10:23 CST 2018


On Jan 9, 2018, at 3:07 PM, Jose Cheyo Jimenez <cheyo at masters3d.com> wrote:
> Hi Chris,
> 
> This is great. Thanks for spending time on this! I am in favor of `case #unknown` to only match unknown cases. 
> 
> 1) Would #uknown be available to RawRepresentable structs?

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.

What do you have in mind?  If your raw representation is itself an enum, then of course this would work.

> 2) How is the #uknown pattern accomplished? Are you suggesting to capture all the compile time known cases so you can do a diff during 
> runtime? (Sorry this is not obvious to me)

The internals of the compiler would handle this, it is difficult to explain unless you know the bowels of silgen and irgen :-)

-Chris




More information about the swift-evolution mailing list