New JEP: Switch Expressions for the Java Language
Brian Goetz
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....
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/amber-spec-experts/attachments/20171211/e26be8a5/attachment.html>
More information about the amber-spec-experts
mailing list