<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></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 Jul 10, 2016, at 10:34 PM, Xiaodi Wu <<a href="mailto:xiaodi.wu@gmail.com" class="">xiaodi.wu@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><br class="Apple-interchange-newline"><br style="font-family: Palatino-Roman; font-size: 14px; font-style: normal; font-variant-caps: 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=""><div class="gmail_quote" style="font-family: Palatino-Roman; font-size: 14px; font-style: normal; font-variant-caps: 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;">On Sun, Jul 10, 2016 at 11:21 PM, Erica Sadun<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:erica@ericasadun.com" target="_blank" class="">erica@ericasadun.com</a>></span><span class="Apple-converted-space"> </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 style="word-wrap: break-word;" class=""><div class=""><span class=""><blockquote type="cite" class=""><div class="">On Jul 10, 2016, at 10:16 PM, Xiaodi Wu <<a href="mailto:xiaodi.wu@gmail.com" target="_blank" class="">xiaodi.wu@gmail.com</a>> wrote:</div><div class=""><div dir="ltr" style="font-family: Palatino-Roman; font-size: 14px; font-style: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;" class=""><div class="gmail_extra"><div class="gmail_quote"><div class="">Given patterns A, B, C, and D, suppose a value x matches A, C, and D, whereas another value y matches B and D, and a third value matches B and C. When evaluating x, y, or z, which statements are executed in the following switch statement? How many of these reach the default case? What happens if I append `fallthrough` at the end of case D? What happens if I move case B after case D? (Yes, I know it is possible to figure it out [my understanding of the answer to the first question is appended below], but I hope you'll agree with me that this is much more difficult to decipher than any switch statement that's currently possible.)</div><div class=""><br class=""></div><div class="">```</div><div class="">switch x /* or y, or z */ {</div><div class="">case A:</div><div class=""> <span class="Apple-converted-space"> </span>// ...</div><div class=""> <span class="Apple-converted-space"> </span>continue</div><div class="">case B:</div><div class=""> <span class="Apple-converted-space"> </span>// ...</div><div class=""> <span class="Apple-converted-space"> </span>if C ~= x /* or y, or z, whichever is switched over */ {</div><div class=""> <span class="Apple-converted-space"> </span>continue</div><div class=""> <span class="Apple-converted-space"> </span>}</div><div class=""> <span class="Apple-converted-space"> </span>fallthrough</div></div></div></div></div></blockquote><div class=""><br class=""></div></span><div class="">I'd say it would be fair to disallow continue and fallthrough to occur in the same clause</div></div></div></blockquote><div class=""><br class=""></div><div class="">Why should `fallthrough` be prohibited but implicit `break` become mandatory in such a clause? If `continue` were to be implemented in this context, I'd want the full power of the keyword, including being allowed to `continue` conditionally, `continue` with different labels, and round out the case if no conditions are satisfied with either `fallthrough` or `break` (or, for that matter, `return`, etc.).</div></div></div></blockquote><br class="">I do not understand. `break` is already implicit unless no other code is used. </div><div><br class=""></div><div><font face="Menlo" class="">case something:</font></div><div><font face="Menlo" class=""> if condition { continue }</font></div><div><font face="Menlo" class=""> // ends here. the compiler knows not to go forward and it's not an empty clause</font></div><div><font face="Menlo" class="">case somethingElse:</font></div><br class=""><div class="">`fallthrough` means "ignore the next case statement and execute its clause".</div><div class=""><br class=""></div><div class="">-- E</div></body></html>