clarity needed for the non-sealed keyword

Brian Goetz brian.goetz at oracle.com
Fri Oct 9 17:59:43 UTC 2020


> Getting used to hyphen is not an issue.

It may not be an issue *for you*, but clearly it is an issue for (say) 
Florian.  Your issue is about lexing.  But unfortunately, we have to 
deal with the _union of all these issues_, and some may pull in other 
directions from others.  This is the balance of which I spoke earlier.

> It is only that when using
> hyphen the keywords will always be contextual, whereas with the other
> option, that need not be the case.

This is not quite correct.  For a hyphenated keyword where one of the 
words is already a keyword, like non-static, it can be a real keyword.  
It is only when _neither_ word is a keyword are we necessarily 
contextual.  (Which is to say, contextuality is independent of 
hyphenation.)  The informational JEP on keyword management 
(https://openjdk.java.net/jeps/8223002) covers both options.

> And we have a JEP, discussing the various options considered, this
> kind of option's pros and cons could be added in the JEP.

For a given JEP, we could easily expand the JEP text by 10x if we 
brought in all the alternatives to every sub-sub-decision.  But who 
would this serve?  The purpose of a JEP varies through the project 
lifecycle, but by the time we get to the end, the purpose largely 
converges to what are we actually delivering, and why.  People want to 
know what sealed classes are, why we are getting them, and how they 
work.  The  purpose of the JEP document at this point is not to throw a 
worldwide syntax bikeshed party, but including all the syntax 
alternatives would likely result in exactly that.

> I also feel that the contextual keywords should not be listed along
> with the other 51 keywords as is shown in
> https://docs.oracle.com/javase/specs/jls/se15/preview/specs/sealed-classes-jls.html#jls-3

Yes, the inclusion of non-sealed in this table was a short-term issue 
with the first preview and has been resolved.



More information about the amber-dev mailing list