JEP proposed to target JDK 12: 325: Switch Expressions (Preview) (original) (raw)

Stephen Colebourne scolebourne at joda.org
Thu Aug 23 12:16:25 UTC 2018


As I have expressed previously on amber-dev, I find the design adopted here to be overly complex and with a poor syntax choice. There are aspects to like, and the proposal is better than earlier versions. I also acknowledge that this is a proposal to create a preview language feature, however in all likelihood, there will be no further changes to the syntax/design once integrated as a preview.

Some specific objections:

(FYI, "classic" uses colon and has fallthrough-by-default, "enhanced" uses arrow -> and does not allow fall-through).

var name = match (trafficLight) { case RED: "Red"; case YELLOW: "Yellow"; case GREEN: "Green"; };

In summary, the world will not end if the JEP 325 progresses, and this proposal is much better than previous ones. However I believe that by taking the route of expanding switch rather than using a different keyword/symbol the result has been greater complexity than is necessary to meet the actual goal of "expression switch".

thanks Stephen

On 17 August 2018 at 18:44, <mark.reinhold at oracle.com> wrote:

The following JEP is proposed to target JDK 12:

325: Switch Expressions (Preview) http://openjdk.java.net/jeps/325 Feedback on this proposal is more than welcome, as are reasoned objections. If no such objections are raised by 23:00 UTC on Friday, 24 August, or if they’re raised and then satisfactorily answered, then per the JEP 2.0 process proposal [1] I’ll target this JEP to JDK 12. - Mark

[1] http://cr.openjdk.java.net/~mr/jep/jep-2.0-02.html



More information about the jdk-dev mailing list