Treatment of nested 'break'
Brian Goetz
brian.goetz at oracle.com
Wed May 9 20:32:43 UTC 2018
> The key readability question is: can I readily find this value break's target? I think the answer will usually be "yes", even when nested in other constructs. If not, I worry that that's a fatal problem with 'break', and we should be looking at a different keyword.
The thing this model tries to avoid is having “break” and “break e” in the same scope apply to different constructs. Code like:
if (foo)
break;
else
break 3;
seems pretty confusing. The model here is that break is like return; the type of its operand must agree with the enclosing method.
More information about the amber-spec-experts
mailing list