Switch expressions spec

Gavin Bierman gavin.bierman at oracle.com
Thu Mar 28 14:28:33 UTC 2019

> On 15 Mar 2019, at 20:09, Brian Goetz <brian.goetz at oracle.com> wrote:
> At the same time, we also reaffirmed our choice to _not_ allow throw from one half of a conditional:
>    int x = foo ? 3 : throw new FooException()
> But John has this right — the high order bit is that every expression should have a defined normal completion, and a type, even if computing sub-expressions (or in this case, sub-statements) might throw.  And without at least one arm yielding a value, it would be impossible to infer the type of the expression.  

That was exactly the thinking behind the spec.


More information about the amber-spec-observers mailing list