clarity needed for the non-sealed keyword
Pravin Jain
pravin at zensoftech.co.in
Fri Oct 9 19:23:54 UTC 2020
Thanks Remi for the information.
regards,
Pravin
On Sat, Oct 10, 2020 at 12:44 AM <forax at univ-mlv.fr> wrote:
>
> ----- Mail original -----
> > De: "Pravin Jain" <pravin at zensoftech.co.in>
> > À: "Remi Forax" <forax at univ-mlv.fr>
> > Cc: "Brian Goetz" <brian.goetz at oracle.com>, "Florian Weimer" <fw at deneb.enyo.de>, "amber-dev"
> > <amber-dev at openjdk.java.net>
> > Envoyé: Vendredi 9 Octobre 2020 16:39:59
> > Objet: Re: clarity needed for the non-sealed keyword
>
> > Hi Remi,
>
> Hi,
>
> >
> > My point here was that in the JEP for keyword management for Java
> > Language, this option has not been considered, while discussing all
> > the other options.
>
> see the answer of Brian.
>
> Furthermore, we have tried to use # and ` in other features in the past.
> The symbol # was proposed before using :: for method reference, because it is used in the javadoc to reference a method, but after testing a prototype, people found that # was too big/bold visually.
> The symbol ` was proposed for raw strings, a feature that was abandoned but it may be used for string interpolation in the future.
>
> >
> > Thanks and regards,
> > Pravin
>
> regards,
> Rémi
>
> >
> > On Fri, Oct 9, 2020 at 12:47 PM <forax at univ-mlv.fr> wrote:
> >>
> >> ----- Mail original -----
> >> > De: "Pravin Jain" <pravin at zensoftech.co.in>
> >> > À: "Brian Goetz" <brian.goetz at oracle.com>
> >> > Cc: "Florian Weimer" <fw at deneb.enyo.de>, "Remi Forax" <forax at univ-mlv.fr>,
> >> > "amber-dev" <amber-dev at openjdk.java.net>
> >> > Envoyé: Vendredi 9 Octobre 2020 08:08:10
> >> > Objet: Re: clarity needed for the non-sealed keyword
> >>
> >> > 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.
> >>
> >> using one or several hyphens in names, usually referred as kebab-case because if
> >> the word is using two hyphens it looks like a spit, is pretty commons in
> >> several programming languages [1] (ok, most of them are dialects of LISP).
> >>
> >> >
> >> > 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.
> >>
> >> Nope, no lookahead,
> >> a lookahead is when the parser needs to read one (or more) tokens in advance,
> >> here, the work is done by the lexer before the token reaches the parser.
> >>
> >> What you need is a lexer with some rules enabled or disabled given the context,
> >> it's a fairly old technique, lex, the lexer from the 70ies [2], has lexing
> >> modes.
> >> And it solves both the need for contextual keywords like "module" or "record"
> >> that have different meaning depending where they are declared and hyphen
> >> keywords.
> >>
> >> >
> >> > 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.
> >>
> >> If it doesn't work with jshell, please submit a bug !
> >>
> >> >
> >> > I understand that # may not look good, but if could be used, then there are less
> >> > problems.
> >>
> >> Nope, most people will never think that the keyword "non-sealed" requires some
> >> bookkeepings. And that's exactly what we want.
> >>
> >> >
> >> > Thanks and regards,
> >> > Pravin
> >>
> >> regards,
> >> Rémi
> >>
> >> [1]
> >> https://en.wikipedia.org/wiki/Naming_convention_(programming)#Multiple-word_identifiers
> >> [2] https://en.wikipedia.org/wiki/Lex_(software)
> >>
> >> >
> >> > 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
> >
> >
> >
> > --
> > Pravin Jain
> > (M)+91-9426054269
--
Pravin Jain
(M)+91-9426054269
More information about the amber-dev
mailing list