Disallowing break label (and continue label) inside an expression switch

Dan Smith daniel.smith at oracle.com
Wed Mar 28 23:13:22 UTC 2018


> On Mar 23, 2018, at 1:41 PM, Brian Goetz <brian.goetz at oracle.com> wrote:
> 
> I prefer the simplicity that "all expressions either complete normally or complete abruptly with cause exception."

Just want to emphasize that this is a really important property of the language, and of what we mean when we call some things "statements" and other things "expressions".

A good overview here:

https://docs.oracle.com/javase/specs/jls/se10/html/jls-14.html#jls-14.1 <https://docs.oracle.com/javase/specs/jls/se10/html/jls-14.html#jls-14.1>

Of course, we can change these definitions. But introducing expressions that can complete abruptly for control flow reasons is a significantly more disruptive change than your typical "add a new kind of expression" feature.

—Dan


More information about the amber-spec-observers mailing list