<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class="">Good questions. The answer at a high level is "you break binary and source compatibility", and if you care about binary compatibility everything will fall to pieces (read: crashes, possibly undefined behavior). So our only goal on the binary compatibility is to make the "falling to pieces" as deterministic as possible, as described as a "Future direction"; we want library authors to not do this by mistake, and if they do we want apps to fail to launch rather than potentially corrupting user data.</div><div class=""><br class=""></div><div class="">For libraries that don't care about binary compatibility, breaking source compatibility is an option, if not one to be taken lightly. So:</div><div class=""><br class=""></div><div class="">- Adding a case to a frozen enum will result in <i class="">errors</i> in all switch statements without catch-all cases ('default' or '_' patterns), with the diagnostic saying that there is now an unhandled pattern. This is essentially the behavior of enums in Swift 4.</div><div class=""><br class=""></div><div class="">- Changing an enum from frozen to non-frozen will result in <i class="">errors</i> in all switch statements without catch-all cases, with the diagnostic saying that a switch over a non-frozen enum must include a catch-all pattern or `unknown case`. This is the diagnostic people will see when <i class="">migrating</i> from Swift 4 to Swift 5, so it has to be good anyway.</div><div class=""><br class=""></div><div class="">I'll add this to the proposal. Thanks, Nacho!</div><div class=""><br class=""></div><div class="">Jordan</div><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Jan 5, 2018, at 10:54, Ignacio Soto 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="">I love the <a href="https://github.com/apple/swift-evolution/pull/777" class="">revision to the proposal</a>, but I have a couple of remaining questions that don't seem to be addressed in the doc and I'm curious about:<div class=""><div class=""><ul class=""><li class="">What happens if a library maintainer adds a new case to a <i class="">@frozen</i> enum?<br class=""></li><li class="">What happens if a library maintainer changes an enum from <i class="">@frozen</i> to non-frozen?<br class=""></li></ul><div class="">Thanks!</div></div></div></div><br clear="all" class=""><br class="">-- <br class=""><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">Ignacio Soto</div>
_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></body></html>