<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=""><div class="">The only deal breaker for me is enumeration completeness checking. default gives me "all other cases", but I could happily replace that with case _.</div><div class=""><br class=""></div><div class="">-- E</div><br class=""><div><blockquote type="cite" class=""><div class="">On Dec 9, 2015, at 4:45 PM, Chris Lattner 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=""><span style="font-family: Palatino-Roman; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">On Dec 9, 2015, at 3:24 PM, J. Charles N. M. &lt;</span><a href="mailto:jcharles.nmbiada@gmail.com" class="" style="font-family: Palatino-Roman; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">jcharles.nmbiada@gmail.com</a><span style="font-family: Palatino-Roman; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">&gt; wrote:</span><div style="font-family: Palatino-Roman; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" class=""><div class=""><p dir="ltr" class="">I agree, the default case has no interest since _ is more "swift”.<br class=""></p></div></blockquote><div class="">I don’t think I expressed what I meant to. &nbsp;I’ll try again:</div><div class=""><br class=""></div><div class="">1. The “case _” syntax already works and yet we have “default” anyways.</div><div class="">2. This is for a reason. &nbsp;It is more readable and familiar. &nbsp;</div><div class="">3. “default” is completely different than ++/— and&nbsp;c-style-for. Someone unfamiliar with it won’t look at it and be puzzled.</div><div class="">4. People use “default” all the time, making it dissimilar to ++, c-style-for, and fallthrough.</div><div class="">5. It is a redundancy in the language, and I agree that redundancy needs to be justified.</div><div class=""><br class=""></div><div class="">In terms of justifying/defending keeping default, I’ll point out two arguments:</div><div class=""><br class=""></div><div class="">1) We have had default and “case _” ever since Swift has been public. &nbsp;If you look at bodies of existing swift code, they almost unanimously use “default” instead of “case _”. &nbsp;This argues that default is more familiar and more widely used. &nbsp;It isn’t some legacy barnacle on the side that people generally ignore.</div><div class=""><br class=""></div><div class="">2) This redundancy is precedented even in non-C-family languages like Haskell. &nbsp;Haskell’s pattern matching works similarly to Swifts (really, swifts works similarly to Haskell’s :-), and even Haskell uses “otherwise” [a] to serve the purposes of “default” in swift. &nbsp;While it is true that people could use “| True = 42” in Haskell, they almost always use "| otherwise = 42”. &nbsp;I don’t think this is an accident, this reflects on the readability difference and the intentionality difference. &nbsp;</div><div class=""><br class=""></div><div class="">-Chris</div><div class=""><br class=""></div><div class="">[a] Yes, I know that otherwise isn’t a keyword in Haskell, its a constant in the standard prelude.</div><br class=""><blockquote type="cite" class=""><div class=""><div class=""><br class="webkit-block-placeholder"></div><div class="gmail_quote">Le&nbsp;10 déc. 2015 12:08 AM, "Jacob Bandes-Storch via swift-evolution" &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; a écrit&nbsp;:<br type="attribution" class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div dir="ltr" class="">Sounds like the team/community has already shown that similarity with C isn't a priority that overrides clarity/simplicity in the language. Thus, +1<div class="gmail_extra"><br class=""><div class="gmail_quote">On Wed, Dec 9, 2015 at 3:06 PM, Chris Lattner via swift-evolution<span class="Apple-converted-space">&nbsp;</span><span dir="ltr" class="">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>&gt;</span><span class="Apple-converted-space">&nbsp;</span>wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div class="" style="word-wrap: break-word;"><div class=""><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Dec 9, 2015, at 3:01 PM, Mustafa Yusuf via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class=""><div class=""><div class=""><div class="" style="font-size: 10pt; font-family: Verdana, Arial, Helvetica, sans-serif;"><div class=""><br class=""></div><div class="">Hello all. In switch statements in swift if all the possible cases aren't covered we have to supply a default case.<br class=""></div><div class=""><br class=""></div><div class="">&nbsp; &nbsp; let number = 10<br class=""></div><div class=""><br class=""></div><div class="">&nbsp; &nbsp; switch number {<br class=""></div><div class="">&nbsp; &nbsp; case 10: print("yay")<br class=""></div><div class="">&nbsp; &nbsp; case 12: print("close")<br class=""></div><div class="">&nbsp; &nbsp; default: print("try again")</div><div class="">&nbsp; &nbsp; }<br class=""></div><div class=""><br class=""></div><div class="">My proposal is replace it with the "case _:".<br class=""></div><div class=""><br class=""></div><div class="" style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;">&nbsp; &nbsp; let number = 10<br class=""></div><div class="" style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><br class=""></div><div class="" style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;">&nbsp; &nbsp; switch number {<br class=""></div><div class="" style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;">&nbsp; &nbsp; case 10: print("yay")<br class=""></div><div class="" style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;">&nbsp; &nbsp; case 12: print("close")<br class=""></div><div class="" style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;">&nbsp; &nbsp; case _: print("try again")<br class=""></div><div class="" style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;">&nbsp; &nbsp; }<br class=""></div><div class=""><br class=""></div><div class="">Since underscore in swift means "whatever I don't care" it suits here better than "default". Correct me If I am wrong but this is the only use for "default" keyword in swift I guess. So we can completely remove "default" keyword from the language.<br class=""></div></div><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=RC5Cq0zAxCHc1sM9Uy3-2BojrrUAw-2F96zH69NULNHPvCslvdAWVxFPatYqjoDiRb7Q3EgLqm6kAtN3Y8PJd96JZJBEX-2BGOB-2BO1RSgbeUddRPfnNY4iqt4BDptltY2IW1vBi9If3WzLLwBq7R8NbfcAKe20DVwEXtqhCJ6oNJCh0vv41VQgcPrysET-2FQbUs-2Fy7-2F3T3oOaH9LE8SrdRwboiyYlwtWHPLhTLqL-2FahDRrJyPs-3D" alt="" width="1" height="1" border="0" class="" style="min-height: 1px !important; width: 1px !important; border-width: 0px !important; margin: 0px !important; padding: 0px !important;"></div></div></blockquote><br class=""></div></div></div><div class="">FWIW, this is already supported.&nbsp; We *also* support default for clarity of code / because it reads better, and for similarly with the (extended) C family of languages.</div><div class=""><br class=""></div><div class="">-Chris</div><br class=""><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=P-2BsYbBZHRBuLDBJaL4DIKDNfkkjpROowTyRAObV11qxNF6r-2FmW9Dz9-2FJokcxzd9sYsFLKPasd32mQiH1sgxyQlqTjrIyXoLwFTzjhcqZ7JkRwJWET3nVojOvFHT0HznZzcEECdKzDR9WgNVfXk8dGNrDYHsH4sVcKqSR22cmYD57sqiYRXqxn9LrSTqJKX0gvkxDU8atYeEgfWhWcTI9fn900Pvtbx6Dx0UOw1QTxO4-3D" alt="" width="1" height="1" border="0" class="" style="min-height: 1px !important; width: 1px !important; border-width: 0px !important; margin: 0px !important; padding: 0px !important;"></div><br class="">_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""><br class=""></blockquote></div><br class=""></div></div><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=Jyrm1EQ6Ui8x50yXi4-2B72km8qdG5vHfi9xSHNwE4oko7Tm-2BepIaJjfEQBtD2-2BK2uZRAh1T4X4FobcDufsHkU4jb-2BuUpfhCrpoWqS2-2FjU3Ppqm0GZ-2F-2BaUkn7mmB3JnlW2Jes5BxfwlvYuTireYh9XiVJ8Ir75J5Oew9qbd4Onu8fpW6UW-2B7t-2F9M7xQKJKt47qwFPvihug45FrZRVrhXnWJd2KBqra-2FEsex-2FUDPD5qu6Q-3D" alt="" width="1" height="1" border="0" class="" style="min-height: 1px !important; width: 1px !important; border-width: 0px !important; margin: 0px !important; padding: 0px !important;"><span class="Apple-converted-space">&nbsp;</span><br class="">_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""><br class=""></blockquote></div></div></blockquote></div><br class="" style="font-family: Palatino-Roman; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=r5jpKsi6nat7oa43lpCLi5GRGm2utDkbDscuFklXZ2e8gpqIv95d44TxzLCVAL51-2BJ5ylyen5IPNmtIPU4R34Y4P-2FWdYjeolSFqMWb70tlFUYOp-2FQw0-2FxYZb8xB1T7WNRf-2FHidsC2aIO1MFTPNDmJEHRpwTGiL3PcVftBm95tBMQfDRVjJvDPmOD0FAI3ymn7wNOkjJHsRWYmP2xzZ2R4hv0vAUzxwWv7rsZsRKoXMA-3D" alt="" width="1" height="1" border="0" style="font-family: Palatino-Roman; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; height: 1px !important; width: 1px !important; border-width: 0px !important; margin: 0px !important; padding: 0px !important;" class=""><span style="font-family: Palatino-Roman; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class=""><span class="Apple-converted-space">&nbsp;</span>_______________________________________________</span><br style="font-family: Palatino-Roman; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Palatino-Roman; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">swift-evolution mailing list</span><br style="font-family: Palatino-Roman; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="mailto:swift-evolution@swift.org" style="font-family: Palatino-Roman; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">swift-evolution@swift.org</a><br style="font-family: Palatino-Roman; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" style="font-family: Palatino-Roman; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></div></blockquote></div><br class=""></body></html>