<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=""><br class=""><div><blockquote type="cite" class=""><div class="">On Feb 12, 2016, at 9:45 , Amir Michail 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=""><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 Feb 12, 2016, at 12:41 PM, Ross O'Brien &lt;<a href="mailto:narrativium+swift@gmail.com" class="">narrativium+swift@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">I have a suggestion.<div class="">Suppose we think of 'switch' as being like a non-optional type. The compiler does its thing and tries to ensure that the switched expression will match something, and enforces a default if it cannot verify a matching state.</div><div class="">Could we force the switch? i.e. suffix the 'switch' keyword with an exclamation mark, to say: the programmer insists that one of these cases will match; there's no need for a default case, but if nothing matches then crash.</div><div class=""><br class=""></div></div></div></blockquote><div class=""><br class=""></div><div class="">This doesn’t solve the more general problem&nbsp;<font size="2" class="">— namely, that of required deep knowledge of the standard libraries.</font></div><div class=""><font size="2" class=""><br class=""></font></div><div class=""><font size="2" class="">A more general solution would be to provide a way for API writers to issue (heuristic) warnings for suboptimal usage of their APIs.</font></div></div></div></div></blockquote></div><br class=""><div class="">This is a good observation. I think it deserves its own design and its own thread, though.</div><div class=""><br class=""></div><div class="">Jordan</div></body></html>