<html><body><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000"><div><br></div><div><br></div><hr id="zwchr" data-marker="__DIVIDER__"><div data-marker="__HEADERS__"><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><b>Envoyé: </b>Vendredi 2 Mars 2018 20:45:52<br><b>Objet: </b>Re: Disallowing break label (and continue label) inside an expression switch<br></blockquote></div><div data-marker="__QUOTED_TEXT__"><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;">On Mar 2, 2018, at 8:12 AM, Brian Goetz <<a href="mailto:brian.goetz@oracle.com" class="" target="_blank">brian.goetz@oracle.com</a>> wrote:<br class=""><div><blockquote class=""><br class="Apple-interchange-newline"><div class=""><span style="font-family: Helvetica; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Do we disallow the "break TOP" and return in the inner switch?</span></div></blockquote><blockquote class=""><div class=""><span style="font-family: Helvetica; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class=""> IOW, does the expression form a barrier through which control</span></div></blockquote><blockquote class=""><div class=""><span style="font-family: Helvetica; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">can only pass via break or exceptions?</span></div></blockquote></div><br class=""><div class="">IIRC last time we talked about this that was the consensus.</div><div class="">It's consistent with what Kevin just wrote also, about constraining</div><div class="">the result of a switch-expr.</div><div class=""><br class=""></div><div class="">We currently don't have any expressions which can branch,</div><div class="">just return normally or throw.  Let's keep it that way.</div></blockquote><div><br></div><div>I'm glad we all agree here.<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><div class=""><br class=""></div><div class="">(Remember we had an option for lambdas to branch</div><div class="">outside the lambda expression, and we decisively shut</div><div class="">it down for various reasons.)</div><div class=""><br class=""></div><div class="">We *do* have expressions which can *internally branch*</div><div class="">without completing.  Those are lambdas.  Switch expressions</div><div class="">should also be able to have arbitrary control flow inside</div><div class="">(if the coder decides).  But that "barrier" idea expresses</div><div class="">the key constraint:  That the branch labels used inside</div><div class="">the switch are operationally disjoint from those outside.</div><div class=""><br class=""></div><div class="">(Separately, as a syntax constraint, labels enclosing</div><div class="">the same bit of syntax should be distinct.  But that</div><div class="">doesn't mean an outer label is ever reachable from</div><div class="">inner control flow.  Trying to reach across the barrier</div><div class="">must be an error.)</div><div class=""><br class=""></div><div class="">If someone wants to write code like Remi's puzzlers,</div><div class="">fine, but they have to refactor to a statement-switch,</div><div class="">and assign the result to a temp, like today.  Statements</div><div class="">can branch to locations other than their standard</div><div class="">completion point.</div></blockquote><div><br></div><div>yes !<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><div class=""><br class=""></div><div class="">— John</div></blockquote><div><br></div><div>Rémi<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><br></blockquote></div></div></body></html>