Make 'package' and 'import' contextual keywords

Remi Forax forax at univ-mlv.fr
Mon Nov 28 21:38:54 UTC 2022


----- Original Message -----
> From: "Brian Goetz" <brian.goetz at oracle.com>
> To: "Tagir Valeev" <amaembo at gmail.com>
> Cc: "amber-spec-experts" <amber-spec-experts at openjdk.org>
> Sent: Monday, November 28, 2022 9:05:51 PM
> Subject: Re: Make 'package' and 'import' contextual keywords

> I would not have predicted this coming from an IDE developer, so this is quite
> interesting.

IDEs are kind of rich, they keep the grammar around (or a reduced form the of grammar) to avoid to re-parse the whole file each time there is a new keystroke so contextual keywords are not an issue.

> 
> Doing this with the keywords that were added in 1.2, 1.4, and 5 (assert, enum,
> etc) would right some historical wrongs (but you know my opinions about
> over-rotating towards fixing mistakes of the past.).

@interface is for me the worst offender, anyway i agree.

> 
> And then there’s `goto`...

already reserved by John to express tail method calls :) 

> 
>> On Nov 28, 2022, at 2:56 PM, Tagir Valeev <amaembo at gmail.com> wrote:
>> 
>> Hello!
>> 
>> Recent discussion about contextual keywords emerged an opposite desire for me.
>> As we already have many contextual keywords, why not expand this to old
>> fullfledged keywords to return some names to the identifier namespace. I can
>> think of 'import' and 'package' which are meaningful as a keywords only at
>> top-level of Java file. Allowing variables with such names could be desired in
>> some programs and should not break much. At least, I occasionally want to
>> create variables with such names. What do you think? Ok, it's just a crazy
>> idea.

Rémi

>> 
>> With best regards,
> > Tagir Valeev


More information about the amber-spec-experts mailing list