New JEP: Switch Expressions for the Java Language
brian.goetz at oracle.com
Mon Dec 11 20:03:54 UTC 2017
> I think this sort of falls out for free; expressions are generally
> usable as statements, unless we can't determine their standalone type
> (like lambdas). However, I'm not sure this would be good practice.
I'm not sure either. Ignoring the value of an expression is often a smell.
BTW I don't think people will do this just because they hate break; the
alternative is worse (see message on similar topic on amber-dev.)
> To be more clear, I think what I'm asking is whether we would permit
> cases to not produce a value, if the entire switch were not being used
> as an expression. Doing this would kind of sort of make the original
> switch statement relatively obsolete. That feels weird, but on the
> other hand, maybe being able to consistently use new-style switches
> more and more of the time would be a good thing?
I think we need more examples, either in favor or against....
More information about the amber-spec-observers