<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<br>
<blockquote type="cite"
cite="mid:CBA7D034-E67C-4DFC-B4EA-CF26F9BB104F@oracle.com">
<div class=""><br class="">
</div>
<div class="">The rest of it is about where to put the sharp
edges: Can I</div>
<div class="">break-e from a switch-e wherever I might consider
doing return</div>
<div class="">from a method/lambda? Or does break-e have extra
restrictions</div>
<div class="">to prevent certain ambiguities? Your answer is the
latter.</div>
</blockquote>
<br>
Right. To avoid ambiguity with other breaky contexts, we let the
innermost breaky context determine the allowable break modes. <br>
<br>
<blockquote type="cite"
cite="mid:CBA7D034-E67C-4DFC-B4EA-CF26F9BB104F@oracle.com">
<div class="">Speaking of ambiguities, should this be illegal,
even</div>
<div class="">though under your rules it happens to be
unambiguous?</div>
<div class="">Or is it just a puzzler we tolerate?</div>
<div class=""><br class="">
</div>
<div class="">
<div>
<div class=""><span class="" style="float: none; display:
inline !important;"> e-switch {</span><br class="">
<span class="" style="float: none; display: inline
!important;"> LABEL:</span><br class="">
<span class="" style="float: none; display: inline
!important;"> s-switch {</span><br class="">
<span class="" style="float: none; display: inline
!important;"> { int LABEL = 2; break LABEL; }</span><br
class="">
<span class="" style="float: none; display: inline
!important;"> }</span><br class="">
<span class="" style="float: none; display: inline
!important;"> }</span><br class="">
</div>
</div>
</div>
</blockquote>
<br>
It could be allowed (since you can't break-e from the switch), but
it seems safer to call it a compile error. After all, you can
always alpha-rename the label.<br>
<br>
<blockquote type="cite"
cite="mid:CBA7D034-E67C-4DFC-B4EA-CF26F9BB104F@oracle.com">
<div class="">
<div>
<div class=""><span class="" style="float: none; display:
inline !important;">Also the other way:</span></div>
<div class=""><span class="" style="float: none; display:
inline !important;"><br class="">
</span></div>
<div class=""><span class="" style="float: none; display:
inline !important;"> LABEL:</span></div>
<div class=""><span class="" style="float: none; display:
inline !important;"> s-switch {</span><br class="">
<span class="" style="float: none; display: inline
!important;"> e-switch { int LABEL = 2; break
LABEL; }</span><br class="">
<span class="" style="float: none; display: inline
!important;"> }</span><br class="">
</div>
<div class=""><span class="" style="float: none; display:
inline !important;"><br class="">
</span></div>
<div class=""><span class="" style="float: none; display:
inline !important;">You want "break LABEL" to be
immediately recognized as</span></div>
<div class=""><span class="" style="float: none; display:
inline !important;">either a break-l or a break-e. The
above cases seem to</span></div>
<div class="">make it hard to do so. We could declare such
code</div>
<div class="">pathological and demand a relabel in either
case,</div>
<div class="">just as we declare local variable shadowing
pathological</div>
<div class="">in most cases, demanding a renaming of one of
the</div>
<div class="">variables. Local variable shadowing is more
likely</div>
<div class="">to occur than label shadowing, given that labels</div>
<div class="">are a rare construct, so maybe we just let the</div>
<div class="">above be a puzzler, rather than add a rule.</div>
</div>
</div>
</blockquote>
<br>
Or, make it the same rule. If in "break x", x could resolve as
either a label or an expression, call it an ambiguity. (In either
case, depending on whether you rename the variable or the label, you
could then get a different error, which is "we don't serve that kind
of break round these parts.") But I think its the same game either
way.<br>
</body>
</html>