clarity needed for the non-sealed keyword
Pravin Jain
pravin at zensoftech.co.in
Fri Oct 9 06:08:10 UTC 2020
Hi Brian,
One of the points which has not been considered, is using an ASCII
letter which has not been used by any other standard tokens(operator,
separator) e.g. using one of # or ` (hash or backtick)
Yes, it may not be natural, so was the _(underscore) when it was used
in a numeric literal, but readibility was good _(underscore),
similarly using a # instead of
hyphen in new keywords may also be considered. It would not have the
problem of ambiguity, and readibility will not be as bad.
The hyphenated keywords require a look ahead, which consumes white
spaces including new-line characters. This would be possible for
compilers and IDEs to manage to some extend but, a very big ask for
the REPL tools like jshell.
I tried using non-sealed on a separate line with jshell to define a
non-sealed class, but it is getting tokenized as three tokens.
I could easily define an abstract class by starting with abstract on a
separate line, but this doesn't work for non-sealed keyword.
I understand that # may not look good, but if could be used, then
there are less problems.
Thanks and regards,
Pravin
On Fri, Oct 9, 2020 at 1:10 AM Brian Goetz <brian.goetz at oracle.com> wrote:
>
>
> > But why does the keyword contain a “-”? Why wasn't “nonsealed” good
> > enough?
>
> The rationale for the creation of hyphenated keywords is well
> documented. See, for example:
>
> http://mail.openjdk.java.net/pipermail/amber-spec-experts/2019-January/000945.html
>
> and
>
> https://openjdk.java.net/jeps/8223002
>
>
--
Pravin Jain
(M)+91-9426054269
More information about the amber-dev
mailing list