expression switch vs. procedural switch
john.r.rose at oracle.com
Wed Mar 14 00:27:20 UTC 2018
On Mar 13, 2018, at 5:23 PM, John Rose <john.r.rose at oracle.com> wrote:
> Also, even for e-switches an explicit exhaustiveness marker is
> desirable. For both kinds of switches, there are cases where
> the user wants to say, "I know I have covered all the possibilities"
> and thus turn off the effects of exhaustiveness checking, including
> DA rules and whatever DA-like rule we define for e-switches.
P.S. You probably surmised, correctly, that this involves injecting
an implicit exception throw, at an implicit default. Whether the
compiler asserts exhaustivness from type analysis, or the user
asserts it just because, the runtime has to have a backup plan
to throw a MatchError or SurpriseInSwitchError, to keep the
JVM's verifier happy.
More information about the amber-spec-observers