Draft JEP: Keyword Management for the Java Language

Remi Forax forax at univ-mlv.fr
Wed May 1 12:07:11 UTC 2019

Thanks for this write-up,

two remarks,
- for the constraints on hyphenated keywords, using int-typed expressions is perhaps a little too clever because the compiler has to provide meaningful error message for the user (and IDEs automatic completion of not yet fully form expressions), by example, if there is an hyphenated keyword new-fun, for the snippet return A::new-fun, the expression is not valid but there are two interpretations A::new - fun or A:: new-fun. I think it's better to use a grammar approach (which keywords can be at left side or right side of an expression). Also the current rule doesn't work well if in the future we want to introduce operator overloading.
- the example total-switch in section "hyphenated keywords" is invalid given the constraints you give.


----- Mail original -----
> De: "Alex Buckley" <alex.buckley at oracle.com>
> À: "jdk-dev" <jdk-dev at openjdk.java.net>
> Envoyé: Mercredi 1 Mai 2019 02:50:47
> Objet: Draft JEP: Keyword Management for the Java Language

> Evolving the Java language often means new keywords for new features,
> but new keywords risk breaking existing programs. In the Project Amber
> expert group, Brian Goetz suggested a technique for generating new
> keywords that balances compatibility and readability -- _hyphenated
> keywords_ -- and there is already a language feature raring to use it
> (JEP 354, Switch Expressions).
> We have now produced an Informational JEP to record the intent and
> detail of hyphenated keywords, for Feature JEPs may rely on. It also
> captures a policy for managing (that is, stewarding) Java's keywords
> more broadly. Your comments are welcome.
>   https://bugs.openjdk.java.net/browse/JDK-8223002
> Alex

More information about the jdk-dev mailing list