Expression switch exception naming
mark at io7m.com
Fri Mar 30 19:06:46 UTC 2018
On 2018-03-30T14:39:30 -0400
Brian Goetz <brian.goetz at oracle.com> wrote:
> To be clear, I was describing:
> - We'd always do exhaustiveness checking for expression switches
> - A default / total pattern always implies exhaustive
> - We'd additionally consider an expression switch to be exhaustive if
> all known enums are present _and_ the enum type is in the same module as
> the switch
> But that's probably too fussy.
That seems rather unpleasant: If my API returns values of a sealed type
and I expect API consumers to match on/switch on values of that type
(consider something like Scala's Either type), it'd be very nasty if
they didn't get exhaustiveness checks just because the consumers live
outside of my module.
Perhaps I've misunderstood and that wasn't what was intended?
Additionally... If we're tying things to modules, what will happen to
OSGi? The module system there isn't integrated with the JPMS in any
sense yet. I suppose you could sort of argue that the entire OSGi
system lives in the unnamed module, but ...
Mark Raynsford | http://www.io7m.com
More information about the amber-spec-experts