Annotation-based syntax for module-info.java
Remi Forax
forax at univ-mlv.fr
Mon Jun 12 14:46:55 UTC 2017
Hi Markus,
----- Mail original -----
> De: "Markus Keller" <markus_keller at ch.ibm.com>
> À: jigsaw-dev at openjdk.java.net
> Cc: "Daniel Megert" <daniel_megert at ch.ibm.com>
> Envoyé: Lundi 12 Juin 2017 15:26:10
> Objet: Annotation-based syntax for module-info.java
> [I know this is coming way too late, and my recent accident that
> incapacitated me for several weeks didn't help either. Nevertheless, I
> think the current module-info.java syntax was a snap decision that should
> not end up in the Java 9 spec.]
i hope you're well now,
and as you said, it's too late, and it doesn't solve the issue we had (see below ...)
>
> The discussions about restricted keywords
> http://openjdk.java.net/projects/jigsaw/spec/issues/#RestrictedKeywords
> and the difficulties with defining a proper grammar for module-info.java
> indicate that something could be fundamentally wrong with the chosen
> approach that tries to come up with a new way of specifying a language.
The problem is not to define the grammar, the module-info grammar is very straight forward.
The problem is how to introduce new keywords when the language evolves without breaking the source compatibility as we have done with assert and enum in the past.
Even if we can use annotations (that's ugly but it works) to solve the particular case of the module-info, we will have the same issue when we will want to introduce new keywords like 'var', 'data', 'closed', 'value'*, etc in the future.
Local keyword (named restricted keyword in the spec) is a good answer for specifying how a keyword and an identifier can have the same name and disambiguate them.
cheers,
Rémi
* those keywords are among the ones proposed by projects Amber and Valhalla for the next releases of Java.
More information about the jigsaw-dev
mailing list