<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=""><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=""><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=""><div style="margin: 0px; line-height: normal;" class=""><font face="Arial" size="4" class="">Hi</font></div><div style="margin: 0px; line-height: normal;" class=""><font face="Arial" size="4" class=""><br class=""></font></div><div style="margin: 0px; line-height: normal;" class=""><font face="Arial" size="4" class="">I’ve been drilling down on the syntax of enumerated types with associated data in the current release version of Swift 3.</font></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-family: Arial; font-size: large;" class="">I’ve pasted below a section of a Playground that captures an issue I’d like to raise.</span></div><div style="margin: 0px; line-height: normal;" class=""><font face="Arial" size="4" class=""><br class=""></font></div><div style="margin: 0px; line-height: normal;" class=""><font face="Arial" size="4" class="">In summary:</font></div><div style="margin: 0px; line-height: normal;" class=""><font face="Arial" size="4" class=""><br class=""></font></div><div style="margin: 0px; line-height: normal;" class=""><font face="Arial" size="4" class="">Consider the following </font></div><div style="margin: 0px; line-height: normal;" class=""><div style="margin: 0px; font-size: 18px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(196, 34, 117);" class="">enum</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> Vehicle {</span></div><div style="margin: 0px; font-size: 18px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(196, 34, 117);" class="">case</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> car(petrol: </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);" class="">Bool</span><span style="font-variant-ligatures: no-common-ligatures;" class="">, sizeCC: </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);" class="">Int</span><span style="font-variant-ligatures: no-common-ligatures;" class="">)</span></div><div style="margin: 0px; font-size: 18px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(196, 34, 117);" class="">case</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> plane(engines : </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);" class="">Int</span><span style="font-variant-ligatures: no-common-ligatures;" class="">)</span></div><div style="margin: 0px; font-size: 18px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(196, 34, 117);" class="">case</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> other(</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);" class="">String</span><span style="font-variant-ligatures: no-common-ligatures;" class="">)</span></div><div style="margin: 0px; font-size: 18px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(196, 34, 117);" class="">case</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> none</span></div><div style="margin: 0px; font-size: 18px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">}</span></div><div style="margin: 0px; font-size: 18px; line-height: normal; font-family: Menlo; color: rgb(33, 150, 28);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(196, 34, 117);" class="">let</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> myJourney : </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(83, 154, 164);" class="">Vehicle</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> = .</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(49, 89, 93);" class="">other</span><span style="font-variant-ligatures: no-common-ligatures;" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(200, 27, 19);" class="">"pogo stick"</span><span style="font-variant-ligatures: no-common-ligatures;" class="">)</span></div></div><div style="margin: 0px; line-height: normal;" class=""><font face="Arial" size="4" class=""><br class=""></font></div><div style="margin: 0px; line-height: normal;" class=""><font face="Arial" size="4" class=""><i class="">Whereas the following is clear</i></font></div><div style="margin: 0px; font-size: 18px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(196, 34, 117);" class="">if</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(196, 34, 117);" class="">case</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> .</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(49, 89, 93);" class="">other</span><span style="font-variant-ligatures: no-common-ligatures;" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(196, 34, 117);" class="">_</span><span style="font-variant-ligatures: no-common-ligatures;" class="">) = </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(83, 154, 164);" class="">myJourney</span></div><div style="margin: 0px; font-size: 18px; line-height: normal; font-family: Menlo;" class=""><br class=""></div><div style="margin: 0px; line-height: normal;" class=""><font face="Arial" size="4" class=""><i class="">the following shorthand equivalent is potentially confusing for the sake of 3 characters</i></font></div><div style="margin: 0px; font-size: 18px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: rgb(196, 34, 117);" class="">if</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(196, 34, 117);" class="">case</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> .</span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(49, 89, 93);" class="">other</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> = </span><span style="font-variant-ligatures: no-common-ligatures; color: rgb(83, 154, 164);" class="">myJourney</span></div><div style="margin: 0px; font-size: 18px; line-height: normal; font-family: Menlo;" class=""><br class=""></div><div style="margin: 0px; line-height: normal;" class=""><font face="Arial" class=""><font size="4" class="">- In the first case, the presence of the underscore does communicate that something is being assigned, but dropped.</font></font></div><div style="margin: 0px; font-size: 18px; line-height: normal;" class=""><font face="Arial" class="">- In the second case, the reader could easily be mislead into thinking that = was supposed to be == as there no apparent place to assign anything.</font></div><div style="margin: 0px; font-size: 18px; line-height: normal;" class=""><font face="Arial" class=""><br class=""></font></div><div style="margin: 0px; line-height: normal;" class=""><font face="Arial" class=""><font size="4" class="">My suggestion would simply be to drop the shorthand as it’s ambiguous?</font></font></div><div style="margin: 0px; line-height: normal;" class=""><font face="Arial" class=""><font size="4" class=""><br class=""></font></font></div><div style="margin: 0px; line-height: normal;" class=""><font face="Arial" class=""><font size="4" class=""><br class=""></font></font></div><div style="margin: 0px; line-height: normal;" class=""><font face="Arial" class=""><font size="4" class="">Nick Outram</font></font></div><div style="margin: 0px; font-size: 18px; line-height: normal; font-family: Menlo;" class=""><br class=""></div><div style="margin: 0px; font-size: 18px; line-height: normal; font-family: Menlo;" class=""><br class=""></div><div style="margin: 0px; font-size: 18px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #c42275" class=""></span></div></div></div></body></html>